Skip to content

Commit 55bd87c

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 <ldennington@github.com>
1 parent abab2db commit 55bd87c

File tree

1 file changed

+63
-2
lines changed

1 file changed

+63
-2
lines changed

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

Lines changed: 63 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
env:
912
DO_WIN_CODESIGN: ${{ secrets.WIN_CODESIGN_CERT_SECRET_NAME != '' && secrets.WIN_CODESIGN_PASS_SECRET_NAME != '' }}
1013
DO_WIN_GPGSIGN: ${{ secrets.WIN_GPG_KEYGRIP_SECRET_NAME != '' && secrets.WIN_GPG_PRIVATE_SECRET_NAME != '' && secrets.WIN_GPG_PASSPHRASE_SECRET_NAME != '' }}
@@ -541,7 +544,7 @@ jobs:
541544
git/.github/macos-installer/*.pkg
542545
# End build and sign Mac OSX installers
543546

544-
# Build unsigned Ubuntu package
547+
# Build and sign Debian package
545548
create-linux-unsigned-artifacts:
546549
runs-on: ubuntu-latest
547550
container:
@@ -636,10 +639,68 @@ jobs:
636639
# Move Debian package for later artifact upload
637640
mv "$PKGNAME.deb" "$GITHUB_WORKSPACE"
638641
642+
- name: Upload artifacts
643+
uses: actions/upload-artifact@v4
644+
with:
645+
name: linux-unsigned-artifacts
646+
path: |
647+
*.deb
648+
649+
create-linux-artifacts:
650+
runs-on: ubuntu-latest
651+
needs: [prereqs, create-linux-unsigned-artifacts]
652+
environment: release
653+
steps:
654+
- name: Log into Azure
655+
uses: azure/login@v2
656+
with:
657+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
658+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
659+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
660+
661+
- name: Check out repository (for akv-secret Action)
662+
uses: actions/checkout@v4
663+
with:
664+
path: git
665+
666+
- name: Download GPG secrets
667+
id: gpg-secrets
668+
uses: ./git/.github/actions/akv-secret
669+
with:
670+
vault: ${{ secrets.AZURE_VAULT }}
671+
secrets: |
672+
${{ secrets.LINUX_GPG_KEYGRIP_SECRET_NAME }} > $output:keygrip
673+
${{ secrets.LINUX_GPG_PRIVATE_SECRET_NAME }} base64> $output:private-key
674+
${{ secrets.LINUX_GPG_PASSPHRASE_SECRET_NAME }} > $output:passphrase
675+
676+
- name: Prepare for GPG signing
677+
run: |
678+
# Install debsigs
679+
sudo apt-get install -y debsigs
680+
681+
# Import GPG key
682+
echo -n '${{ steps.gpg-secrets.outputs.private-key }}' | gpg --import --no-tty --batch --yes
683+
684+
# Configure GPG
685+
echo "allow-preset-passphrase" > ~/.gnupg/gpg-agent.conf
686+
gpg-connect-agent RELOADAGENT /bye
687+
/usr/lib/gnupg2/gpg-preset-passphrase --preset '${{ steps.gpg-secrets.outputs.keygrip }}' <<<'${{ steps.gpg-secrets.outputs.passphrase }}'
688+
689+
- name: Download artifacts
690+
uses: actions/download-artifact@v4
691+
with:
692+
name: linux-unsigned-artifacts
693+
694+
- name: Sign Debian package
695+
run: |
696+
# Sign Debian package
697+
version="${{ needs.prereqs.outputs.tag_version }}"
698+
debsigs --sign=origin --verify --check microsoft-git_"$version".deb
699+
639700
- name: Upload artifacts
640701
uses: actions/upload-artifact@v4
641702
with:
642703
name: linux-artifacts
643704
path: |
644705
*.deb
645-
# End build unsigned Debian package
706+
# End build and sign Debian package

0 commit comments

Comments
 (0)