Skip to content

Commit 25064da

Browse files
authored
Merge pull request #1227 from dotnet/fix-signing
Fix code signing step in release workflow
2 parents aa48247 + d598ddc commit 25064da

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

.github/SignClient.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ permissions:
1717

1818
jobs:
1919
release:
20-
runs-on: ubuntu-24.04
20+
runs-on: windows-latest
21+
environment: Signing
22+
permissions:
23+
id-token: write # Required for Azure CLI Login
2124
steps:
2225
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
2326

@@ -79,22 +82,28 @@ jobs:
7982
run-id: ${{ steps.findrunid.outputs.runid }}
8083
github-token: ${{ github.token }}
8184

85+
# Login to Azure using a ServicePrincipal configured to authenticate agaist a GitHub Action
86+
- name: 🪪 Authorize signing
87+
uses: azure/[email protected]
88+
with:
89+
client-id: ${{ vars.AZURE_CLIENT_ID }}
90+
tenant-id: ${{ vars.AZURE_TENANT_ID }}
91+
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
92+
8293
- name: 🔏 Code sign
83-
shell: pwsh
8494
run: >
8595
rm global.json # avoid a need to install a particular SDK version
8696
87-
dotnet tool install --tool-path obj SignClient
97+
dotnet tool install --tool-path obj --prerelease sign
8898
89-
obj/SignClient sign
90-
--baseDirectory '${{ runner.temp }}/deployables'
91-
--input '**/*'
92-
--config '${{ github.workspace }}/.github/SignClient.json'
93-
--filelist '${{ github.workspace }}/.github/signfiles.txt'
94-
--user '${{ secrets.CODESIGN_USERNAME }}'
95-
--secret '${{ secrets.CODESIGN_SECRET }}'
96-
--name 'Nerdbank.GitVersioning'
97-
--descriptionUrl 'https://github.com/dotnet/Nerdbank.GitVersioning'
99+
obj/sign code azure-key-vault
100+
'**/*'
101+
--base-directory '${{ runner.temp }}/deployables'
102+
--file-list '${{ github.workspace }}/.github/signfiles.txt'
103+
--azure-key-vault-url "${{ vars.KEY_VAULT_URL }}"
104+
--azure-key-vault-certificate "${{ vars.KEY_VAULT_CERTIFICATE }}"
105+
--azure-credential-type azure-cli
106+
shell: pwsh
98107

99108
- name: 💽 Upload artifacts to release
100109
shell: pwsh
@@ -108,7 +117,7 @@ jobs:
108117
}
109118
110119
- name: 🚀 Push NuGet packages
111-
run: dotnet nuget push ${{ runner.temp }}/deployables/*.nupkg --source https://api.nuget.org/v3/index.json -k '${{ secrets.NUGET_API_KEY }}'
120+
run: dotnet nuget push ${{ runner.temp }}\deployables\*.nupkg --source https://api.nuget.org/v3/index.json -k '${{ secrets.NUGET_API_KEY }}'
112121
if: ${{ env.NUGET_API_KEY_DEFINED == 'true' }}
113122

114123
- name: 🚀 Push NPM packages

0 commit comments

Comments
 (0)