@@ -101,6 +101,22 @@ jobs:
101101 run : |
102102 cargo build --release --target ${{ matrix.target }} -p spacetimedb-cli -p spacetimedb-standalone -p spacetimedb-update
103103
104+ - name : List synced certificates (diagnostic)
105+ if : ${{ runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/') }}
106+ shell : pwsh
107+ env :
108+ SM_HOST : ${{ vars.SM_HOST }}
109+ SM_API_KEY : ${{ secrets.SM_API_KEY }}
110+ SM_CLIENT_CERT_FILE : D:\Certificate_pkcs12.p12
111+ SM_CLIENT_CERT_PASSWORD : ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
112+ run : |
113+ Write-Host "=== Certificates in CurrentUser\My ==="
114+ Get-ChildItem Cert:\CurrentUser\My | Format-Table Subject, Thumbprint, NotAfter -AutoSize
115+ Write-Host "=== Certificates in LocalMachine\My ==="
116+ Get-ChildItem Cert:\LocalMachine\My | Format-Table Subject, Thumbprint, NotAfter -AutoSize
117+ Write-Host "=== smctl keypair list ==="
118+ smctl keypair ls
119+
104120 - name : Sign binaries for Windows
105121 if : ${{ runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/') }}
106122 shell : pwsh
@@ -111,22 +127,27 @@ jobs:
111127 SM_CLIENT_CERT_PASSWORD : ${{ secrets.SM_CLIENT_CERT_PASSWORD }}
112128 DIGICERT_KEYPAIR_ALIAS : ${{ secrets.DIGICERT_KEYPAIR_ALIAS }}
113129 run : |
114- $ErrorActionPreference = 'Continue '
130+ $ErrorActionPreference = 'Stop '
115131 $targetDir = Join-Path $env:GITHUB_WORKSPACE 'target\x86_64-pc-windows-msvc\release'
116- $failed = $false
132+
133+ # Find the code signing certificate synced from DigiCert
134+ $cert = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert | Select-Object -First 1
135+ if (-not $cert) {
136+ $cert = Get-ChildItem Cert:\LocalMachine\My -CodeSigningCert | Select-Object -First 1
137+ }
138+ if (-not $cert) {
139+ throw "No code signing certificate found in certificate store"
140+ }
141+ $thumbprint = $cert.Thumbprint
142+ Write-Host "Using certificate: $($cert.Subject) [$thumbprint]"
143+
117144 foreach ($exe in @('spacetimedb-update.exe','spacetimedb-cli.exe','spacetimedb-standalone.exe')) {
118145 $path = Join-Path $targetDir $exe
119146 Write-Host "Signing $exe..."
120- & smctl sign --verbose --keypair-alias $env:DIGICERT_KEYPAIR_ALIAS --input $path 2>&1 | Tee-Object -Variable output
121- $output = $output -join "`n"
122- if ($output -match 'FAILED') {
123- Write-Host "::error::$exe signing FAILED"
124- $failed = $true
125- } else {
126- Write-Host "$exe signed successfully"
127- }
147+ & signtool.exe sign /sha1 $thumbprint /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 $path
148+ if ($LASTEXITCODE -ne 0) { throw "Signing failed for $exe (exit code $LASTEXITCODE)" }
149+ Write-Host "$exe signed successfully"
128150 }
129- if ($failed) { exit 1 }
130151
131152 - name : Verify signatures
132153 if : ${{ runner.os == 'Windows' && startsWith(github.ref, 'refs/tags/') }}
0 commit comments