Skip to content

Commit e950cce

Browse files
fix: tolerate CI self-signed signtool verification
1 parent 6fe1075 commit e950cce

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

.github/workflows/release-windows.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,24 @@ jobs:
203203
$signTool = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin" -Recurse -Filter signtool.exe |
204204
Sort-Object FullName -Descending | Select-Object -First 1
205205
if (-not $signTool) { throw "signtool.exe not found" }
206-
& $signTool.FullName verify /pa /v $exe.FullName
206+
207+
$verifyOutput = & $signTool.FullName verify /pa /v $exe.FullName 2>&1
208+
$verifyText = ($verifyOutput | Out-String)
209+
$verifyExitCode = $LASTEXITCODE
210+
Write-Host $verifyText
211+
212+
if ($verifyExitCode -eq 0) {
213+
Write-Host "signtool verify: OK"
214+
exit 0
215+
}
216+
217+
if ($verifyText -match 'terminated in a root\s+certificate which is not trusted by the trust provider') {
218+
Write-Warning "signtool verify reported an untrusted root certificate. This is expected for self-signed CI certificates; continuing."
219+
Write-Host "::warning::SignTool reported an untrusted root certificate. Treating as expected for CI self-signed certs."
220+
exit 0
221+
}
222+
223+
throw "signtool verify failed with exit code $verifyExitCode"
207224
208225
- name: Upload release artifacts for audit
209226
uses: actions/upload-artifact@v4

docs/guides/release-signing-auto-update.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pnpm run release
116116
- 校验 tag 与 `package.json` 版本一致
117117
- 还原签名证书并校验 `verify:windows-signing-env`
118118
- 执行 `pnpm run release`(内含 `verify:release`
119-
- 对产物执行 `signtool verify`
119+
- 对产物执行 `signtool verify`(自签名 CI 证书触发“不受信任根证书”时降级为 warning,不阻断发布)
120120
- 上传产物并生成 provenance attestation
121121

122122
发布前脚本链路(当前):

0 commit comments

Comments
 (0)