Skip to content

Commit 94c5a12

Browse files
committed
chore: executables signing update
1 parent 4e902d6 commit 94c5a12

3 files changed

Lines changed: 20 additions & 3 deletions

File tree

.github/assets/release-assets-config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
{
7070
"name": "SHA256SUMS.pem",
7171
"description": "Cosign certificate"
72+
},
73+
{
74+
"name": "terragrunt-signing-key.asc",
75+
"description": "GPG public key for signature verification"
7276
}
7377
]
7478
}

.github/scripts/release/sign-checksums.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ set -e
66
# Usage: sign-checksums.sh <bin-directory>
77
#
88
# Environment variables:
9-
# GPG_FINGERPRINT - GPG key fingerprint for signing (required)
9+
# GPG_FINGERPRINT - GPG key fingerprint for signing (required)
10+
# SIGNING_GPG_PASSPHRASE - GPG key passphrase (required)
1011
#
1112
# Outputs:
1213
# SHA256SUMS.gpgsig - GPG detached signature
@@ -26,6 +27,11 @@ function main {
2627
exit 1
2728
fi
2829

30+
if [[ -z "${SIGNING_GPG_PASSPHRASE}" ]]; then
31+
echo "ERROR: SIGNING_GPG_PASSPHRASE environment variable is not set"
32+
exit 1
33+
fi
34+
2935
# Use pushd/popd to avoid side effects on caller's working directory
3036
pushd "$bin_dir" || exit 1
3137

@@ -38,6 +44,8 @@ function main {
3844
# GPG signing
3945
echo "Signing SHA256SUMS with GPG..."
4046
gpg --batch --yes -u "${GPG_FINGERPRINT}" \
47+
--pinentry-mode loopback \
48+
--passphrase "${SIGNING_GPG_PASSPHRASE}" \
4149
--output SHA256SUMS.gpgsig \
4250
--detach-sign SHA256SUMS
4351

.github/workflows/release.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,21 @@ jobs:
7272
- name: Generate SHA256SUMS
7373
run: .github/scripts/release/generate-checksums.sh bin
7474

75-
- name: Import GPG key
75+
- name: Import GPG key and export public key
76+
env:
77+
SIGNING_GPG_PRIVATE_KEY: ${{ secrets.SIGNING_GPG_PRIVATE_KEY }}
7678
run: |
77-
echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 --decode | gpg --import
79+
echo "${SIGNING_GPG_PRIVATE_KEY}" | base64 --decode | gpg --batch --import
7880
GPG_FINGERPRINT=$(gpg --list-secret-keys --keyid-format LONG | awk '/^sec/{sub(/.*\//, "", $2); print $2; exit}')
7981
echo "GPG_FINGERPRINT=${GPG_FINGERPRINT}" >> "${GITHUB_ENV}"
82+
gpg --armor --export "${GPG_FINGERPRINT}" > bin/terragrunt-signing-key.asc
8083
8184
- name: Install Cosign
8285
uses: sigstore/cosign-installer@v3
8386

8487
- name: Sign SHA256SUMS
88+
env:
89+
SIGNING_GPG_PASSPHRASE: ${{ secrets.SIGNING_GPG_PASSPHRASE }}
8590
run: .github/scripts/release/sign-checksums.sh bin
8691

8792
- name: Verify signatures before upload

0 commit comments

Comments
 (0)