Skip to content

Commit 30de6d0

Browse files
committed
fix gpg signing step
1 parent 2618ca6 commit 30de6d0

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

.github/workflows/go-build.yml

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

33
on:
44
workflow_call:
5+
secrets:
6+
GPG_PRIVATE_KEY:
7+
required: true
8+
GPG_PASSPHRASE:
9+
required: true
510
inputs:
611
service:
712
required: true
@@ -165,12 +170,23 @@ jobs:
165170
merge-multiple: true
166171

167172
- name: package with nfpm
173+
env:
174+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
175+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
176+
GPG_KEY_ID: mail@binarycodes.io
168177
run: |
169178
mkdir -p dist
170179
nfpm pkg --packager archlinux --config nfpm.yaml --target dist/
171180
nfpm pkg --packager deb --config nfpm.yaml --target dist/
181+
172182
# sign the package for arch linux
173-
gpg --batch --yes --detach-sign dist/*.pkg.tar.zst
183+
test -n "$GPG_PRIVATE_KEY" || { echo "GPG_PRIVATE_KEY is empty"; exit 1; }
184+
printf '%s' "$GPG_PRIVATE_KEY" | gpg --batch --import
185+
gpg --batch --list-secret-keys --keyid-format LONG
186+
187+
FPR="$(gpg --batch --list-secret-keys --with-colons | awk -F: '$1=="fpr"{print $10; exit}')"
188+
189+
gpg --batch --yes --local-user "$FPR" --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" --detach-sign dist/*.pkg.tar.zst
174190
175191
- name: upload build artifact
176192
uses: actions/upload-artifact@v4

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,6 @@ 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 }}
29+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)