Skip to content

Commit 8a6be02

Browse files
committed
gha: add GPG-signed tags to release workflow
Align with bcvk release flow: use GPG key import for git identity and signed tags, pass app token to checkout instead of manually setting the remote URL. Requires GPG_PRIVATE_KEY and GPG_PASSPHRASE secrets. Assisted-by: AI Signed-off-by: Alice Frosi <afrosi@redhat.com>
1 parent 2ce41d1 commit 8a6be02

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

‎.github/workflows/release.yaml‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,21 @@ jobs:
2828
with:
2929
client-id: ${{ secrets.APP_ID }}
3030
private-key: ${{ secrets.APP_PRIVATE_KEY }}
31-
permission-contents: write
3231

3332
- name: Checkout
3433
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
3534
with:
3635
fetch-depth: 0
37-
persist-credentials: false
36+
token: ${{ steps.app-token.outputs.token }}
37+
38+
- name: Import GPG key
39+
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0
40+
with:
41+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
42+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
43+
git_user_signingkey: true
44+
git_commit_gpgsign: true
45+
git_tag_gpgsign: true
3846

3947
- name: Extract version
4048
id: version
@@ -50,16 +58,13 @@ jobs:
5058
- name: Create and push tag
5159
env:
5260
TAG: ${{ steps.version.outputs.tag }}
53-
APP_TOKEN: ${{ steps.app-token.outputs.token }}
5461
run: |
5562
if git rev-parse "${TAG}" >/dev/null 2>&1; then
5663
echo "::error::Tag ${TAG} already exists"
5764
exit 1
5865
fi
59-
git tag -a -m "Release ${TAG}" "${TAG}"
60-
git remote set-url origin "https://x-access-token:${APP_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
66+
git tag -s -m "Release ${TAG}" "${TAG}"
6167
git push origin "${TAG}"
62-
git remote set-url origin "https://github.com/${GITHUB_REPOSITORY}.git"
6368
6469
- name: Set up Go
6570
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0

0 commit comments

Comments
 (0)