Skip to content

Commit b09d662

Browse files
vdyeldennington
authored andcommitted
release: add signing step for .deb package
- 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]>
1 parent 0b15eed commit b09d662

File tree

1 file changed

+58
-2
lines changed

1 file changed

+58
-2
lines changed

.github/workflows/build-git-installers.yml

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
tags:
66
- 'v[0-9]*vfs*' # matches "v<number><any characters>vfs<any characters>"
77

8+
permissions:
9+
id-token: write # required for Azure login via OIDC
10+
811
jobs:
912
# Check prerequisites for the workflow
1013
prereqs:
@@ -474,7 +477,7 @@ jobs:
474477
git/.github/macos-installer/*.pkg
475478
# End build and sign Mac OSX installers
476479

477-
# Build unsigned Ubuntu package
480+
# Build and sign Debian package
478481
create-linux-unsigned-artifacts:
479482
runs-on: ubuntu-latest
480483
container:
@@ -567,10 +570,63 @@ jobs:
567570
# Move Debian package for later artifact upload
568571
mv "$PKGNAME.deb" "$GITHUB_WORKSPACE"
569572
573+
- name: Upload artifacts
574+
uses: actions/upload-artifact@v4
575+
with:
576+
name: linux-unsigned-artifacts
577+
path: |
578+
*.deb
579+
580+
create-linux-artifacts:
581+
runs-on: ubuntu-latest
582+
needs: [prereqs, create-linux-unsigned-artifacts]
583+
environment: release
584+
steps:
585+
- name: Log into Azure
586+
uses: azure/login@v2
587+
with:
588+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
589+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
590+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
591+
592+
- name: Prepare for GPG signing
593+
env:
594+
AZURE_VAULT: ${{ secrets.AZURE_VAULT }}
595+
GPG_KEY_SECRET_NAME: ${{ secrets.GPG_KEY_SECRET_NAME }}
596+
GPG_PASSPHRASE_SECRET_NAME: ${{ secrets.GPG_PASSPHRASE_SECRET_NAME }}
597+
GPG_KEYGRIP_SECRET_NAME: ${{ secrets.GPG_KEYGRIP_SECRET_NAME }}
598+
run: |
599+
# Install debsigs
600+
sudo apt-get install -y debsigs
601+
602+
# Download GPG key, passphrase, and keygrip from Azure Key Vault
603+
key="$(az keyvault secret show --name "$GPG_KEY_SECRET_NAME" --vault-name "$AZURE_VAULT" --query "value" --output tsv)"
604+
passphrase="$(az keyvault secret show --name "$GPG_PASSPHRASE_SECRET_NAME" --vault-name "$AZURE_VAULT" --query "value" --output tsv)"
605+
keygrip="$(az keyvault secret show --name "$GPG_KEYGRIP_SECRET_NAME" --vault-name "$AZURE_VAULT" --query "value" --output tsv)"
606+
607+
# Import GPG key
608+
echo "$key" | base64 -d | gpg --import --no-tty --batch --yes
609+
610+
# Configure GPG
611+
echo "allow-preset-passphrase" > ~/.gnupg/gpg-agent.conf
612+
gpg-connect-agent RELOADAGENT /bye
613+
/usr/lib/gnupg2/gpg-preset-passphrase --preset "$keygrip" <<<"$passphrase"
614+
615+
- name: Download artifacts
616+
uses: actions/download-artifact@v4
617+
with:
618+
name: linux-unsigned-artifacts
619+
620+
- name: Sign Debian package
621+
run: |
622+
# Sign Debian package
623+
version="${{ needs.prereqs.outputs.tag_version }}"
624+
debsigs --sign=origin --verify --check microsoft-git_"$version".deb
625+
570626
- name: Upload artifacts
571627
uses: actions/upload-artifact@v4
572628
with:
573629
name: linux-artifacts
574630
path: |
575631
*.deb
576-
# End build unsigned Debian package
632+
# End build and sign Debian package

0 commit comments

Comments
 (0)