Skip to content

Commit 6506ad4

Browse files
committed
update with crazy-max/ghaction-import-gpg
1 parent 13dcdf0 commit 6506ad4

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

.github/workflows/release.yml

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,33 +20,25 @@ jobs:
2020
git config user.name "$GITHUB_ACTOR"
2121
git config user.email "[email protected]"
2222
23-
- name: Prepare GPG Key
24-
run: |
25-
echo "# Import the GPG Key"
26-
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
27-
28-
echo "Create passphrase file"
29-
echo "$GPG_PASSPHRASE" > passphrase.txt
30-
31-
echo "Store the GPG key ID to a file"
32-
GPG_KEY_ID=$(gpg --list-secret-keys --with-colons | grep 'sec' | cut -d: -f5)
33-
echo "$GPG_KEY_ID" > gpg_key_id.txt
34-
35-
echo "Export the public key to the location chart-releaser expects"
36-
gpg --output /home/runner/.gnupg/pubring.gpg --export "$GPG_KEY_ID"
37-
env:
38-
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
39-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
23+
- name: Import GPG key
24+
id: import_gpg
25+
uses: crazy-max/ghaction-import-gpg@v6
26+
with:
27+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
28+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
4029

41-
- name: Create .cr.yaml
30+
- name: Prepare for Chart Releaser
4231
run: |
32+
# Create a passphrase file for chart-releaser to use for signing
33+
echo "${{ secrets.GPG_PASSPHRASE }}" > passphrase.txt
34+
35+
# Create the .cr.yaml config file using the key ID from the import step
4336
cat <<EOF > .cr.yaml
4437
sign: true
45-
# Read the key from the file.
46-
key: "$(cat gpg_key_id.txt)"
38+
key: "${{ steps.import_gpg.outputs.keyid }}"
4739
passphrase-file: "passphrase.txt"
4840
EOF
49-
41+
5042
- name: Run chart-releaser
5143
uses: helm/[email protected]
5244
with:

0 commit comments

Comments
 (0)