forked from icosa-foundation/open-brush
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workflow to export (encrypted) secrets
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
# yamllint disable rule:line-length | ||
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
name: Backup secrets (to OpenSSL encrypted file) | ||
on: # yamllint disable-line rule:truthy | ||
workflow_dispatch: | ||
push: | ||
|
||
jobs: | ||
backup_secrets: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Backup secrets | ||
env: | ||
SECRETS: toJson({{secrets}}) | ||
OPENSSL_ITER: 1000 | ||
OPENSSL_PASS: ${{secrets.OPENSSL_PASS}} | ||
run: | | ||
echo "$SECRETS" > secrets.txt | ||
openssl enc -aes-256-cbc -pbkdf2 -iter "$OPENSSL_ITER" -salt -in secrets.txt -out secrets.enc.txt -pass pass:"$OPENSSL_PASS" | ||
echo "To decrypt the secrets, use the following command:" | ||
echo "openssl dec -aes-256-cbc -pbkdf2 -iter $OPENSSL_ITER -salt -in secrets.enc.txt -out secrets.txt -pass pass:<your_password>" | ||
- name: Upload encrypted secrets | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: secrets | ||
path: secrets.enc.txt |