Skip to content

Commit

Permalink
fix: move gpg to file
Browse files Browse the repository at this point in the history
Signed-off-by: Mateusz Urbanek <[email protected]>
  • Loading branch information
shanduur committed Oct 31, 2024
1 parent 9c8539a commit 030fcfe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,10 @@ jobs:
ffb60bb8-8422-4d3b-95a1-b20700fb5232 > GPG_PASSPHRASE
- name: Prepare GPG key
run: |
gpg_dir=.cr-gpg
mkdir "$gpg_dir"
keyring="$gpg_dir/secring.gpg"
base64 -d <<< "$GPG_KEYRING_BASE64" > "$keyring"
passphrase_file="$gpg_dir/passphrase"
echo "$GPG_PASSPHRASE" > "$passphrase_file"
echo "CR_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV"
echo "CR_KEYRING=$keyring" >> "$GITHUB_ENV"
./hack/gpg.sh \
"${GPG_KEYRING_BASE64}" \
"${GPG_PASSPHRASE}" \
"${GITHUB_ENV}"
- uses: azure/setup-helm@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
17 changes: 17 additions & 0 deletions hack/gpg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -eou

GPG_KEYRING_BASE64="$1"
GPG_PASSPHRASE="$2"
GITHUB_ENV="$3"

gpg_dir=.cr-gpg
rm -rf "$gpg_dir"
mkdir "$gpg_dir"
keyring="$gpg_dir/secring.gpg"
base64 -d <<< "${GPG_KEYRING_BASE64:?Keyring not set or empty}" > "$keyring"
passphrase_file="$gpg_dir/passphrase"
echo -n "${GPG_PASSPHRASE:?Passphrase not set or empty}" > "$passphrase_file"
echo "CR_PASSPHRASE_FILE=$passphrase_file" >> "$GITHUB_ENV"
echo "CR_KEYRING=$keyring" >> "$GITHUB_ENV"

0 comments on commit 030fcfe

Please sign in to comment.