@@ -360,9 +360,11 @@ jobs:
360
360
# ================================
361
361
# Linux
362
362
# ================================
363
- linux-build :
364
- name : Build Linux
363
+ create- linux-artifacts :
364
+ name : Create Linux Artifacts
365
365
runs-on : ubuntu-latest
366
+ environment : release
367
+ needs : prereqs
366
368
steps :
367
369
- uses : actions/checkout@v4
368
370
@@ -371,78 +373,68 @@ jobs:
371
373
with :
372
374
dotnet-version : 7.0.x
373
375
374
- - name : Install dependencies
375
- run : dotnet restore
376
-
377
376
- name : Build
378
377
run : dotnet build --configuration=LinuxRelease
379
378
380
- - name : Lay out
379
+ - name : Run Linux unit tests
381
380
run : |
382
- mkdir -p linux-build/deb linux-build/tar
383
- mv out/linux/Packaging.Linux/Release/deb/*.deb linux-build/deb
384
- mv out/linux/Packaging.Linux/Release/tar/*.tar.gz linux-build/tar
381
+ dotnet test --configuration=LinuxRelease
385
382
386
- - name : Upload artifacts
387
- uses : actions/upload-artifact@v3
383
+ - name : Log into Azure
384
+ uses : azure/login@v1
388
385
with :
389
- name : linux-build
390
- path : |
391
- linux-build
386
+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
387
+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
388
+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
392
389
393
- linux-sign :
394
- name : Sign Linux tarball and Debian package
395
- needs : linux-build
396
- # ESRP service requires signing to run on Windows
397
- runs-on : windows-latest
398
- environment : release
399
- steps :
400
- - uses : actions/checkout@v4
390
+ - name : Prepare for GPG signing
391
+ env :
392
+ AZURE_VAULT : ${{ secrets.AZURE_VAULT }}
393
+ GPG_KEY_SECRET_NAME : ${{ secrets.GPG_KEY_SECRET_NAME }}
394
+ GPG_PASSPHRASE_SECRET_NAME : ${{ secrets.GPG_PASSPHRASE_SECRET_NAME }}
395
+ GPG_KEYGRIP_SECRET_NAME : ${{ secrets.GPG_KEYGRIP_SECRET_NAME }}
396
+ run : |
397
+ # Install debsigs
398
+ sudo apt install debsigs
401
399
402
- - name : Download artifacts
403
- uses : actions/download-artifact@v3
404
- with :
405
- name : linux-build
400
+ # Download GPG key, passphrase, and keygrip from Azure Key Vault
401
+ key=$(az keyvault secret show --name $GPG_KEY_SECRET_NAME --vault-name $AZURE_VAULT --query "value")
402
+ passphrase=$(az keyvault secret show --name $GPG_PASSPHRASE_SECRET_NAME --vault-name $AZURE_VAULT --query "value")
403
+ keygrip=$(az keyvault secret show -- name $GPG_KEYGRIP_SECRET_NAME --vault-name $AZURE_VAULT --query "value")
406
404
407
- - name : Remove symbols
408
- run : |
409
- rm tar/*symbols*
405
+ # Remove quotes from downloaded values
406
+ key=$(sed -e 's/^"//' -e 's/"$//' <<<"$key")
407
+ passphrase=$(sed -e 's/^"//' -e 's/"$//' <<<"$passphrase")
408
+ keygrip=$(sed -e 's/^"//' -e 's/"$//' <<<"$keygrip")
410
409
411
- - uses : azure/login@v1
412
- with :
413
- creds : ${{ secrets.AZURE_CREDENTIALS }}
410
+ # Import GPG key
411
+ echo "$key" | base64 -d | gpg --import --no-tty --batch --yes
414
412
415
- - name : Set up ESRP client
416
- shell : pwsh
417
- env :
418
- AZURE_VAULT : ${{ secrets.AZURE_VAULT }}
419
- AUTH_CERT : ${{ secrets.AZURE_VAULT_AUTH_CERT_NAME }}
420
- REQUEST_SIGNING_CERT : ${{ secrets.AZURE_VAULT_REQUEST_SIGNING_CERT_NAME }}
421
- run : |
422
- .github\set_up_esrp.ps1
413
+ # Configure GPG
414
+ echo "allow-preset-passphrase" > ~/.gnupg/gpg-agent.conf
415
+ gpg-connect-agent RELOADAGENT /bye
416
+ /usr/lib/gnupg2/gpg-preset-passphrase --preset "$keygrip" <<<"$passphrase"
423
417
424
- - name : Run ESRP client
425
- shell : pwsh
426
- env :
427
- AZURE_AAD_ID : ${{ secrets.AZURE_AAD_ID }}
428
- LINUX_KEY_CODE : ${{ secrets.LINUX_KEY_CODE }}
429
- LINUX_OP_CODE : ${{ secrets.LINUX_OPERATION_CODE }}
418
+ - name : Sign Debian package and tarball
430
419
run : |
431
- python .github/run_esrp_signing.py deb $env:LINUX_KEY_CODE $env:LINUX_OP_CODE
432
- python .github/run_esrp_signing.py tar $env:LINUX_KEY_CODE $env:LINUX_OP_CODE
420
+ # Sign Debian package
421
+ version=${{ needs.prereqs.outputs.version }}
422
+ mv out/linux/Packaging.Linux/Release/deb/gcm-linux_amd64.$version.deb .
423
+ debsigs --sign=origin --verify --check gcm-linux_amd64.$version.deb
433
424
434
- - name : Re-name tarball signature file
435
- shell : bash
436
- run : |
437
- signaturepath=$(find signed/*.tar.gz)
438
- mv "$signaturepath" "${signaturepath%.tar.gz}.asc"
425
+ # Generate tarball signature file
426
+ mv -v out/linux/Packaging.Linux/Release/tar/* .
427
+ gpg --batch --yes --armor --output gcm-linux_amd64.$version.tar.gz.asc \
428
+ --detach-sig gcm-linux_amd64.$version.tar.gz
439
429
440
- - name : Upload signed tarball and Debian package
430
+ - name : Upload artifacts
441
431
uses : actions/upload-artifact@v3
442
432
with :
443
- name : linux-sign
433
+ name : linux-artifacts
444
434
path : |
445
- signed
435
+ ./*.deb
436
+ ./*.asc
437
+ ./*.tar.gz
446
438
447
439
# ================================
448
440
# .NET Tool
@@ -628,13 +620,9 @@ jobs:
628
620
matrix :
629
621
component :
630
622
- os : ubuntu-latest
631
- artifact : linux-sign
632
- command : git-credential-manager
633
- description : debian
634
- - os : ubuntu-latest
635
- artifact : linux-build
623
+ artifact : linux-artifacts
636
624
command : git-credential-manager
637
- description : tarball
625
+ description : linux
638
626
- os : macos-latest
639
627
artifact : osx-x64-sign
640
628
command : git-credential-manager
@@ -652,7 +640,7 @@ jobs:
652
640
command : git-credential-manager
653
641
description : dotnet-tool
654
642
runs-on : ${{ matrix.component.os }}
655
- needs : [ osx-sign, win-sign, linux-sign , dotnet-tool-sign ]
643
+ needs : [ osx-sign, win-sign, create- linux-artifacts , dotnet-tool-sign ]
656
644
steps :
657
645
- uses : actions/checkout@v4
658
646
@@ -672,14 +660,14 @@ jobs:
672
660
}
673
661
674
662
- name : Install Linux (Debian package)
675
- if : contains(matrix.component.description, 'debian ')
663
+ if : contains(matrix.component.description, 'linux ')
676
664
run : |
677
665
debpath=$(find ./*.deb)
678
666
sudo apt install $debpath
679
667
"${{ matrix.component.command }}" configure
680
668
681
669
- name : Install Linux (tarball)
682
- if : contains(matrix.component.description, 'tarball ')
670
+ if : contains(matrix.component.description, 'linux ')
683
671
run : |
684
672
# Ensure we find only the source tarball, not the symbols
685
673
tarpath=$(find ./tar -name '*[[:digit:]].tar.gz')
@@ -797,8 +785,7 @@ jobs:
797
785
uploadDirectoryToRelease('osx-payload-and-symbols'),
798
786
799
787
// Upload Linux artifacts
800
- uploadDirectoryToRelease('linux-build/tar'),
801
- uploadDirectoryToRelease('linux-sign'),
788
+ uploadDirectoryToRelease('linux-artifacts'),
802
789
803
790
// Upload .NET tool package
804
791
uploadDirectoryToRelease('dotnet-tool-sign'),
0 commit comments