Skip to content

Commit 195eb1d

Browse files
committed
fix gpg signing step
1 parent 2618ca6 commit 195eb1d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.github/workflows/go-build.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: generic-go-versionbuild
22

33
on:
44
workflow_call:
5+
secrets:
6+
GPG_PRIVATE_KEY:
7+
required: true
58
inputs:
69
service:
710
required: true
@@ -165,12 +168,22 @@ jobs:
165168
merge-multiple: true
166169

167170
- name: package with nfpm
171+
env:
172+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
173+
GPG_KEY_ID: mail@binarycodes.io
168174
run: |
169175
mkdir -p dist
170176
nfpm pkg --packager archlinux --config nfpm.yaml --target dist/
171177
nfpm pkg --packager deb --config nfpm.yaml --target dist/
178+
172179
# sign the package for arch linux
173-
gpg --batch --yes --detach-sign dist/*.pkg.tar.zst
180+
test -n "$GPG_PRIVATE_KEY" || { echo "GPG_PRIVATE_KEY is empty"; exit 1; }
181+
printf '%s' "$GPG_PRIVATE_KEY_B64" | base64 -d | gpg --batch --import
182+
gpg --batch --list-secret-keys --keyid-format LONG
183+
184+
FPR="$(gpg --batch --list-secret-keys --with-colons | awk -F: '$1=="fpr"{print $10; exit}')"
185+
186+
gpg --batch --yes --local-user "$FPR" --detach-sign dist/*.pkg.tar.zst
174187
175188
- name: upload build artifact
176189
uses: actions/upload-artifact@v4

.github/workflows/go-ssh-keysign-workflow.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,5 @@ jobs:
2424
with:
2525
service: go-ssh-keysign
2626
artifactVersion: ${{ needs.set-version.outputs.short_sha }}
27+
secrets:
28+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}

0 commit comments

Comments
 (0)