Skip to content

Commit

Permalink
release: add signing step for .deb package
Browse files Browse the repository at this point in the history
- sign using Azure-stored certificates & client
- sign on Windows agent via python script
- job skipped if credentials for accessing certificate aren't present

Co-authored-by: Lessley Dennington <[email protected]>
  • Loading branch information
2 people authored and dscho committed Feb 10, 2025
1 parent f6400e6 commit 4ebc418
Showing 1 changed file with 58 additions and 2 deletions.
60 changes: 58 additions & 2 deletions .github/workflows/build-git-installers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
tags:
- 'v[0-9]*vfs*' # matches "v<number><any characters>vfs<any characters>"

permissions:
id-token: write # required for Azure login via OIDC

jobs:
# Check prerequisites for the workflow
prereqs:
Expand Down Expand Up @@ -474,7 +477,7 @@ jobs:
git/.github/macos-installer/*.pkg
# End build and sign Mac OSX installers

# Build unsigned Ubuntu package
# Build and sign Debian package
create-linux-unsigned-artifacts:
runs-on: ubuntu-latest
container:
Expand Down Expand Up @@ -562,10 +565,63 @@ jobs:
# Move Debian package for later artifact upload
mv "$PKGNAME.deb" "$GITHUB_WORKSPACE"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-unsigned-artifacts
path: |
*.deb
create-linux-artifacts:
runs-on: ubuntu-latest
needs: [prereqs, create-linux-unsigned-artifacts]
environment: release
steps:
- name: Log into Azure
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Prepare for GPG signing
env:
AZURE_VAULT: ${{ secrets.AZURE_VAULT }}
GPG_KEY_SECRET_NAME: ${{ secrets.GPG_KEY_SECRET_NAME }}
GPG_PASSPHRASE_SECRET_NAME: ${{ secrets.GPG_PASSPHRASE_SECRET_NAME }}
GPG_KEYGRIP_SECRET_NAME: ${{ secrets.GPG_KEYGRIP_SECRET_NAME }}
run: |
# Install debsigs
sudo apt-get install -y debsigs
# Download GPG key, passphrase, and keygrip from Azure Key Vault
key="$(az keyvault secret show --name "$GPG_KEY_SECRET_NAME" --vault-name "$AZURE_VAULT" --query "value" --output tsv)"
passphrase="$(az keyvault secret show --name "$GPG_PASSPHRASE_SECRET_NAME" --vault-name "$AZURE_VAULT" --query "value" --output tsv)"
keygrip="$(az keyvault secret show --name "$GPG_KEYGRIP_SECRET_NAME" --vault-name "$AZURE_VAULT" --query "value" --output tsv)"
# Import GPG key
echo "$key" | base64 -d | gpg --import --no-tty --batch --yes
# Configure GPG
echo "allow-preset-passphrase" > ~/.gnupg/gpg-agent.conf
gpg-connect-agent RELOADAGENT /bye
/usr/lib/gnupg2/gpg-preset-passphrase --preset "$keygrip" <<<"$passphrase"
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: linux-unsigned-artifacts

- name: Sign Debian package
run: |
# Sign Debian package
version="${{ needs.prereqs.outputs.tag_version }}"
debsigs --sign=origin --verify --check microsoft-git_"$version".deb
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: linux-artifacts
path: |
*.deb
# End build unsigned Debian package
# End build and sign Debian package

0 comments on commit 4ebc418

Please sign in to comment.