This document explains how to set up GPG signing for DEB and RPM packages in the GitHub Actions CI workflow.
You need a GPG key pair for signing packages. If you don’t have one, follow the generation steps below.
Run these commands on your local machine:
# Generate a new GPG key (use RSA 4096-bit)
gpg --full-generate-key
# When prompted:
# - Select: (1) RSA and RSA
# - Key size: 4096
# - Expiration: 0 (key does not expire) or set your preferred expiration
# - Real name: Trndi Release Bot (or your name)
# - Email: your-email@example.com
# - Passphrase: Choose a strong passphrase
# List your keys to find the key ID
gpg --list-secret-keys --keyid-format=long
# Output will look like:
# sec rsa4096/ABCD1234EFGH5678 2025-01-01 [SC]
# The part after rsa4096/ is your KEY_ID
# Export the private key (ASCII armored)
gpg --armor --export-secret-keys YOUR_KEY_ID > gpg-private-key.asc
# Export the public key (for users to verify signatures)
gpg --armor --export YOUR_KEY_ID > gpg-public-key.asc
Click New repository secret and add:
GPG_PRIVATE_KEYgpg-private-key.ascGPG_PASSPHRASEUsers need your public key to verify package signatures. You can:
gpg --keyserver keyserver.ubuntu.com --send-keys YOUR_KEY_ID
gpg --keyserver keys.openpgp.org --send-keys YOUR_KEY_ID
# Copy the public key to your repo
cp gpg-public-key.asc /path/to/trndi2/doc/trndi-signing-key.asc
git add doc/trndi-signing-key.asc
git commit -m "Add package signing public key"
git push
Do both for maximum distribution.
Add instructions to your README or installation guide:
# Import the Trndi signing key
gpg --import trndi-signing-key.asc
# Verify the package signature (using the separate .asc signature file)
gpg --verify trndi_*.deb.asc trndi_*.deb
# Import the Trndi signing key
sudo rpm --import https://raw.githubusercontent.com/slicke/trndi/main/doc/trndi-signing-key.asc
# Verify the package signature
rpm --checksig trndi-*.rpm
The CI workflow automatically signs packages during the build process:
GPG_PRIVATE_KEY secret exists, it proceeds with signing~/.rpmmacros with the key ID and GPG settings for RPM signing.deb.asc file) for the Debian package using gpg --detach-signrpm --addsign (with passphrase piped in) to sign the RPM package (signature embedded)doc/trndi-signing-key.asc to artifacts if it existsThe signing happens in the Linux build matrix for both amd64 and arm64 architectures, right after the fpm packaging step and before moving files to the artifacts/ directory.
Note: DEB packages use detached signatures (separate .asc files) while RPM packages have embedded signatures.
After the workflow runs, you can verify signatures:
# For DEB (using the detached .asc signature file)
gpg --import trndi-signing-key.asc
gpg --verify trndi_*.deb.asc trndi_*.deb
# For RPM
rpm --checksig trndi-*.rpm
Successful verification means the packages haven’t been tampered with and came from you.
-----BEGIN PGP PRIVATE KEY BLOCK----- and -----END PGP PRIVATE KEY BLOCK-------batch mode and pipes the passphrase to avoid this issueGPG_PASSPHRASE is set correctlytrndi-signing-key.ascWhen you need to rotate keys: