Skip to content

Commit 996d684

Browse files
committed
fix(ci): simplify GPG signing with loopback pinentry
- Remove gpg-preset-passphrase (may not exist on CI runners) - Pass --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" directly - Only needs allow-loopback-pinentry in gpg-agent.conf
1 parent 782f2cf commit 996d684

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

releaser/apt_release.sh

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,10 @@ if [[ -n "$GPG_PRIVATE_KEY" ]]; then
136136
echo " Using GPG key: $GPG_KEY_ID"
137137

138138
# Configure gpg-agent for non-interactive signing in CI
139-
# GPG 2.x always protects keys via the agent — preset the passphrase so signing doesn't prompt
140139
mkdir -p ~/.gnupg
141140
chmod 700 ~/.gnupg
142-
cat > ~/.gnupg/gpg-agent.conf <<AGENTCONF
143-
allow-loopback-pinentry
144-
allow-preset-passphrase
145-
AGENTCONF
141+
echo "allow-loopback-pinentry" > ~/.gnupg/gpg-agent.conf
146142
gpg-connect-agent reloadagent /bye 2>/dev/null || true
147-
148-
# Preset passphrase for every secret subkey keygrip
149-
for KEYGRIP in $(gpg --list-secret-keys --with-keygrip --with-colons 2>/dev/null | awk -F: '/^grp/{print $10}'); do
150-
/usr/lib/gnupg/gpg-preset-passphrase --preset --passphrase "$GPG_PASSPHRASE" "$KEYGRIP"
151-
done
152143
else
153144
if [[ "$DRY_RUN" != "true" ]]; then
154145
echo "Error: GPG_PRIVATE_KEY is required for signing (set DRY_RUN=true to skip)"
@@ -228,14 +219,14 @@ cd -
228219
# GPG sign the Release file
229220
if [[ -n "$GPG_KEY_ID" ]]; then
230221
# Detached signature
231-
gpg --batch --yes --armor \
222+
gpg --batch --yes --armor --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
232223
--default-key "$GPG_KEY_ID" \
233224
--detach-sign \
234225
--output "$APT_DIR/dists/stable/Release.gpg" \
235226
"$APT_DIR/dists/stable/Release"
236227

237228
# Inline signature (InRelease)
238-
gpg --batch --yes --armor \
229+
gpg --batch --yes --armor --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE" \
239230
--default-key "$GPG_KEY_ID" \
240231
--clearsign \
241232
--output "$APT_DIR/dists/stable/InRelease" \

0 commit comments

Comments
 (0)