Skip to content

Commit a29b3c5

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 b53d6aa commit a29b3c5

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

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

0 commit comments

Comments
 (0)