Skip to content

Commit e07df13

Browse files
committed
ci: test cert
1 parent 18ad326 commit e07df13

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

.github/scripts/tauri-sign-simplysign.ps1

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,23 @@ function Restart-SimplySignDesktop {
4747
}
4848

4949
function Run-SignTool($signtool, $args) {
50-
$p = Start-Process -FilePath $signtool -ArgumentList $args -NoNewWindow -Wait -PassThru
50+
if (-not $args) { throw "ArgumentList is null" }
51+
52+
# 强制展开成一维数组 -> 去掉 null/空串 -> 转成 string[]
53+
$clean = @($args) `
54+
| ForEach-Object { $_ } `
55+
| Where-Object { $_ -ne $null -and "$_".Trim().Length -gt 0 } `
56+
| ForEach-Object { [string]$_ }
57+
58+
if ($clean.Count -eq 0) { throw "ArgumentList became empty after cleaning" }
59+
60+
Write-Host "signtool args: $($clean -join ' ')"
61+
62+
$p = Start-Process -FilePath $signtool -ArgumentList $clean -NoNewWindow -Wait -PassThru
5163
return $p.ExitCode
5264
}
5365

66+
5467
$signtool = Find-SignTool
5568
$ts = $env:TAURI_SIGN_TIMESTAMP_URL
5669
if (-not $ts) { $ts = "http://time.certum.pl" }
@@ -64,15 +77,15 @@ Ensure-SmartCardService
6477
Clear-ReadOnly $FileToSign
6578

6679
# Base args (NO /as)
67-
$base = @("sign", "/fd", "sha256", "/tr", $ts, "/td", "sha256")
80+
$base = [string[]]@("sign", "/fd", "sha256", "/tr", $ts, "/td", "sha256")
6881

6982
# Strategy set:
7083
# 1) Prefer KSP (CNG) with /a
7184
# 2) Try CSP (legacy) with /a
7285
# 3) Allow user to override by env if needed (for future: /kc etc.)
7386
$strategies = @(
74-
@{ name="KSP-auto"; args= $base + @("/csp","SimplySign KSP","/a",$FileToSign) },
75-
@{ name="CSP-auto"; args= $base + @("/csp","SimplySign CSP","/a",$FileToSign) }
87+
@{ name="KSP-auto"; args= [string[]]($base + @("/csp","SimplySign KSP","/a",$FileToSign)) },
88+
@{ name="CSP-auto"; args= [string[]]($base + @("/csp","SimplySign CSP","/a",$FileToSign)) }
7689
)
7790

7891
# Optional: if later你能拿到 key container,就可以在 workflow env 里填这俩

0 commit comments

Comments
 (0)