优化: 换装脚本本地模式适配与版本号

- 未设签名私钥时自动关 updater 产物, 免 tauri build 中断
- 发版(需签名)分流 publish-release.ps1, 本地换装/正式发布分离
This commit is contained in:
lxy
2026-10-11 07:38:03 +08:00
parent 78dd079344
commit f894196924
3 changed files with 22 additions and 4 deletions
+11 -1
View File
@@ -36,7 +36,17 @@ if ($Mode -eq "verify") {
Write-Host "== 通道2: 全量发版换装(tauri build -> 静默安装 -> 启动验证) =="
Write-Host "[1/4] tauri build(可能 10 分钟级)..."
cmd /c "cargo tauri build 2>&1"
# 本地换装不需要 updater 签名产物:未设私钥时用 --config 关掉 createUpdaterArtifacts,
# 否则 tauri build 必因「A public key has been found, but no private key」报错中断(实测多次),
# 安装段被跳过,只能手工补 swap-install。发版(需签名)走 publish-release.ps1。
$tauriArgs = "cargo tauri build"
if (-not $env:TAURI_SIGNING_PRIVATE_KEY) {
Write-Host " [本地换装模式] 未设 TAURI_SIGNING_PRIVATE_KEY -> 关闭 updater 产物(发版走 publish-release.ps1)"
$override = "$repo\temp\local-no-updater.json"
@{ bundle = @{ createUpdaterArtifacts = $false } } | ConvertTo-Json | Set-Content $override -Encoding utf8
$tauriArgs = "cargo tauri build --config `"$override`""
}
cmd /c "$tauriArgs 2>&1"
if ($LASTEXITCODE -ne 0) { Write-Host "[失败] tauri build"; exit 1 }
$bundle = Get-ChildItem "$repo\target\release\bundle\nsis\*.exe" | Sort-Object LastWriteTime -Descending | Select-Object -First 1