Refactor: fix gpg agent condition

This commit is contained in:
2025-07-28 01:42:56 +08:00
parent 0a792691fc
commit 1e05990bec

View File

@@ -53,7 +53,8 @@ runs:
eval $(gpg-agent --daemon) && \ eval $(gpg-agent --daemon) && \
echo "${{ inputs.gpg-password }}" | \ echo "${{ inputs.gpg-password }}" | \
/usr/lib/gnupg/gpg-preset-passphrase --preset "${{ inputs.gpg-keygrip }}" && \ /usr/lib/gnupg/gpg-preset-passphrase --preset "${{ inputs.gpg-keygrip }}" && \
makepkg -sc --needed --noconfirm --sign && \ makepkg -sc --needed --noconfirm --sign
killall -u "$(id -un)" gpg-agent || true killall -u "$(id -un)" gpg-agent || true
else else
makepkg -sc --needed --noconfirm makepkg -sc --needed --noconfirm
@@ -79,16 +80,14 @@ runs:
- name: Add pkgs to repo db - name: Add pkgs to repo db
run: | run: |
if [[ "${{ inputs.gpg-password }}" != 'none' ]]; then if [[ "${{ inputs.gpg-password }}" != 'none' ]]; then
eval $(gpg-agent --daemon) eval $(gpg-agent --daemon) && \
echo "${{ inputs.gpg-password }}" | \ echo "${{ inputs.gpg-password }}" | \
/usr/lib/gnupg/gpg-preset-passphrase --preset "${{ inputs.gpg-keygrip }}" /usr/lib/gnupg/gpg-preset-passphrase --preset "${{ inputs.gpg-keygrip }}" && \
repo-add --verify --sign \ repo-add --verify --sign \
"repo/${{ inputs.repo-name }}.db.tar.gz" *.pkg.tar.zst "repo/${{ inputs.repo-name }}.db.tar.gz" *.pkg.tar.zst && \
mv *.pkg.tar.zst *.pkg.tar.zst.sig repo mv *.pkg.tar.zst *.pkg.tar.zst.sig repo
killall -u "$(id -un)" gpg-agent killall -u "$(id -un)" gpg-agent || true
else else
repo-add "repo/${{ inputs.repo-name }}.db.tar.zst" *.pkg.tar.zst repo-add "repo/${{ inputs.repo-name }}.db.tar.zst" *.pkg.tar.zst
mv *.pkg.tar.zst repo mv *.pkg.tar.zst repo