Skip to content

Commit b0c2fd7

Browse files
vdyeldenningtonsverrejoh
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> Co-authored-by: Sverre Johansen <sverre.johansen@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 2c43207 commit b0c2fd7

1 file changed

Lines changed: 76 additions & 3 deletions

File tree

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

Lines changed: 76 additions & 3 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: ${{ matrix.arch.runner }}
547550
strategy:
@@ -652,7 +655,77 @@ jobs:
652655
- name: Upload artifacts
653656
uses: actions/upload-artifact@v4
654657
with:
655-
name: linux-artifacts
658+
name: linux-unsigned-${{ matrix.arch.name }}
659+
path: |
660+
*.deb
661+
662+
create-linux-artifacts:
663+
runs-on: ubuntu-latest
664+
needs: [prereqs, create-linux-unsigned-artifacts]
665+
strategy:
666+
matrix:
667+
arch: [amd64, arm64]
668+
environment: release
669+
steps:
670+
- name: Log into Azure
671+
uses: azure/login@v2
672+
with:
673+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
674+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
675+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
676+
677+
- name: Check out repository (for akv-secret Action)
678+
uses: actions/checkout@v4
679+
with:
680+
path: git
681+
682+
- name: Download GPG secrets
683+
id: gpg-secrets
684+
uses: ./git/.github/actions/akv-secret
685+
with:
686+
vault: ${{ secrets.AZURE_VAULT }}
687+
secrets: |
688+
${{ secrets.LINUX_GPG_KEYGRIP_SECRET_NAME }} > $output:keygrip
689+
${{ secrets.LINUX_GPG_PRIVATE_SECRET_NAME }} base64> $output:private-key
690+
${{ secrets.LINUX_GPG_PASSPHRASE_SECRET_NAME }} > $output:passphrase
691+
692+
- name: Prepare for GPG signing
693+
run: |
694+
# Install debsigs
695+
sudo apt-get install -y debsigs
696+
697+
# Stop using SHA-1 for the signature. For details, see
698+
# https://gitlab.com/debsigs/debsigs/-/commit/75c6c8f96e6cdc33bca9c5f32195b68ff35bc32f
699+
# which seems to have made it to have made it into debsigs v0.2.1, but Ubuntu 24.04 is
700+
# stuck with v1.19.
701+
mkdir -p patched-debsigs &&
702+
sed 's/, "--openpgp"//' </usr/bin/debsigs >patched-debsigs/debsigs &&
703+
chmod a+x patched-debsigs/debsigs &&
704+
echo "$PWD/patched-debsigs" >>$GITHUB_PATH
705+
706+
# Import GPG key
707+
echo -n '${{ steps.gpg-secrets.outputs.private-key }}' | gpg --import --no-tty --batch --yes
708+
709+
# Configure GPG
710+
echo "allow-preset-passphrase" > ~/.gnupg/gpg-agent.conf
711+
gpg-connect-agent RELOADAGENT /bye
712+
/usr/lib/gnupg2/gpg-preset-passphrase --preset '${{ steps.gpg-secrets.outputs.keygrip }}' <<<'${{ steps.gpg-secrets.outputs.passphrase }}'
713+
714+
- name: Download artifacts
715+
uses: actions/download-artifact@v4
716+
with:
717+
name: linux-unsigned-${{ matrix.arch }}
718+
719+
- name: Sign Debian package
720+
run: |
721+
# Sign Debian package
722+
version="${{ needs.prereqs.outputs.tag_version }}"
723+
debsigs --sign=origin --verify --check microsoft-git_"$version"_${{ matrix.arch }}.deb
724+
725+
- name: Upload artifacts
726+
uses: actions/upload-artifact@v4
727+
with:
728+
name: linux-${{ matrix.arch }}
656729
path: |
657730
*.deb
658-
# End build unsigned Debian package
731+
# End build and sign Debian package

0 commit comments

Comments
 (0)