Skip to content

Commit 7520b6d

Browse files
bobbyg603claude
andcommitted
Fix publish workflow: use pwsh for glob expansion and dotnet nuget for cloud HSM signing
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c370965 commit 7520b6d

File tree

1 file changed

+32
-17
lines changed

1 file changed

+32
-17
lines changed

.github/workflows/publish.yml

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
jobs:
1212
publish:
1313
runs-on: windows-latest
14+
env:
15+
SM_HOST: ${{ vars.SM_HOST }}
16+
SM_API_KEY: ${{ secrets.SM_API_KEY }}
17+
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
1418

1519
steps:
1620
- uses: actions/checkout@v4
@@ -20,6 +24,9 @@ jobs:
2024
with:
2125
dotnet-version: 8.0.x
2226

27+
- name: Setup NuGet
28+
uses: nuget/setup-nuget@v2
29+
2330
- name: Extract version from tag
2431
id: version
2532
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
@@ -38,33 +45,41 @@ jobs:
3845
run: echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > "${{ runner.temp }}/cert.p12"
3946
shell: bash
4047

41-
- name: Setup DigiCert Software Trust Manager
42-
uses: digicert/code-signing-software-trust-action@v1
43-
env:
44-
SM_HOST: ${{ vars.SM_HOST }}
45-
SM_API_KEY: ${{ secrets.SM_API_KEY }}
46-
SM_CLIENT_CERT_FILE: ${{ runner.temp }}\cert.p12
47-
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
48+
- name: Set SM_CLIENT_CERT_FILE
49+
run: echo "SM_CLIENT_CERT_FILE=${{ runner.temp }}\cert.p12" >> $env:GITHUB_ENV
50+
shell: pwsh
51+
52+
- name: Install SMCTL and KSP
53+
run: |
54+
curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/smtools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o smtools-windows-x64.msi
55+
msiexec /i smtools-windows-x64.msi /quiet /qn
56+
echo C:\Program Files\DigiCert\DigiCert One Signing Manager Tools>> %GITHUB_PATH%
57+
shell: cmd
4858

4959
- name: Sync certificate to Windows store
5060
run: smctl windows certsync --keypair-alias=${{ secrets.SM_KEYPAIR_ALIAS }}
5161
shell: cmd
52-
env:
53-
SM_HOST: ${{ vars.SM_HOST }}
54-
SM_API_KEY: ${{ secrets.SM_API_KEY }}
55-
SM_CLIENT_CERT_FILE: ${{ runner.temp }}\cert.p12
56-
SM_CLIENT_CERT_PASSWORD: ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
5762

5863
- name: Sign NuGet package
59-
run: nuget sign ./nupkg/*.nupkg -Timestamper http://timestamp.digicert.com -CertificateFingerprint ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} -HashAlgorithm SHA256 -Verbosity detailed -Overwrite
60-
shell: cmd
64+
run: |
65+
Get-ChildItem ./nupkg/*.nupkg | ForEach-Object {
66+
nuget sign $_.FullName -Timestamper http://timestamp.digicert.com -CertificateFingerprint ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} -HashAlgorithm SHA256 -Verbosity detailed -Overwrite
67+
}
68+
shell: pwsh
6169

6270
- name: Verify signature
63-
run: nuget verify -All ./nupkg/*.nupkg
64-
shell: cmd
71+
run: |
72+
Get-ChildItem ./nupkg/*.nupkg | ForEach-Object {
73+
nuget verify -All $_.FullName
74+
}
75+
shell: pwsh
6576

6677
- name: Push to NuGet
67-
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
78+
run: |
79+
Get-ChildItem ./nupkg/*.nupkg | ForEach-Object {
80+
dotnet nuget push $_.FullName --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
81+
}
82+
shell: pwsh
6883

6984
- name: Clean up
7085
if: always()

0 commit comments

Comments
 (0)