Skip to content

Commit

Permalink
ci(trunk): Add PGP key environment variable (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
chris3ware authored Feb 4, 2025
1 parent e514406 commit 19aeece
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/get-workflow-token.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:

- name: Encrypt the token for reuse between jobs / workflows
id: encrypt-token
env:
KEY: ${{ secrets.PGP_SECRET_SIGNING_PASSPHRASE }}
TOKEN: ${{ steps.get-workflow-token.outputs.token }}
run: |
ENCRYPTED_TOKEN=$(gpg --symmetric --batch --passphrase "$KEY" \
--output - <(echo "$TOKEN") | base64 -w0)
echo "encrypted-token=$ENCRYPTED_TOKEN" >> $GITHUB_OUTPUT
env:
KEY: ${{ secrets.PGP_SECRET_SIGNING_PASSPHRASE }}
TOKEN: ${{ steps.get-workflow-token.outputs.token }}
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ jobs:
steps:
- name: Decrypt the installation access token
id: decrypt-token
env:
KEY: ${{ secrets.PGP_SECRET_SIGNING_PASSPHRASE }}
run: |
DECRYPTED_TOKEN=$(gpg --decrypt --quiet --batch --passphrase "$KEY" \
--output - <(echo "${{ needs.get-temp-token.outputs.temp-token }}" \
| base64 --decode))
echo "::add-mask::$DECRYPTED_TOKEN"
echo "temp-token=$DECRYPTED_TOKEN" >> $GITHUB_OUTPUT
env:
KEY: ${{ secrets.PGP_SECRET_SIGNING_PASSPHRASE }}
- name: Checkout repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/terraform-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
steps:
- name: Decrypt the installation access token
id: decrypt-token
env:
KEY: ${{ secrets.PGP_SECRET_SIGNING_PASSPHRASE }}
run: |
DECRYPTED_TOKEN=$(gpg --decrypt --quiet --batch --passphrase "$KEY" \
--output - <(echo "${{ needs.get-temp-token.outputs.temp-token }}" \
| base64 --decode))
echo "::add-mask::$DECRYPTED_TOKEN"
echo "temp-token=$DECRYPTED_TOKEN" >> $GITHUB_OUTPUT
env:
KEY: ${{ secrets.PGP_SECRET_SIGNING_PASSPHRASE }}
- name: Checkout repository
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/trunk-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:

- name: Decrypt the installation access token
id: decrypt-token
env:
KEY: ${{ secrets.PGP_SECRET_SIGNING_PASSPHRASE }}
run: |
DECRYPTED_TOKEN=$(gpg --decrypt --quiet --batch --passphrase "$KEY" \
--output - <(echo "${{ needs.get-temp-token.outputs.temp-token }}" \
Expand Down

0 comments on commit 19aeece

Please sign in to comment.