Skip to content

Commit b2f3d93

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 0ec2fa8 commit b2f3d93

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 != '' }}
@@ -540,7 +543,7 @@ jobs:
540543
git/.github/macos-installer/*.pkg
541544
# End build and sign Mac OSX installers
542545

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

0 commit comments

Comments
 (0)