Skip to content

Commit 4ebc418

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 f6400e6 commit 4ebc418

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

0 commit comments

Comments
 (0)