Files
DevFlow/scripts/finish-release.ps1

59 lines
2.5 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 发布收尾:杀挂起脚本 -> 手动签名 0.1.3 -> latest.json -> 上传 -> 远端验证
$ErrorActionPreference = "Stop"
$repo = "E:\wk-lab\devflow"
$nsis = "$repo\target\release\bundle\nsis"
$exe = "$nsis\devflow_0.1.3_x64-setup.exe"
$key = "$env:USERPROFILE\.tauri\devflow.key"
$site = "suke-dev"
$remoteDir = "/var/www/app-site/download/devflow"
$baseUrl = "https://app.1216.top/download/devflow"
$notes = "版本更新与自动升级全链路上线:设置页新增「关于」,支持应用内检查/下载/安装更新"
# 1. 杀挂起的发布脚本与构建残留
Get-Process -Id 14328,2008,26208,28276,19412 -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
Write-Host "[1/5] 挂起进程已清理"
# 2. 手动签名(key 文件内容经 env 传入——-k/ev 传路径会被当 base64 解码,报 Invalid symbol 58)
Set-Location $repo
$env:TAURI_SIGNING_PRIVATE_KEY = (Get-Content $key -Raw).Trim()
$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = ""
cmd /c "cargo tauri signer sign -p `"`" --app-version 0.1.3 `"$exe`" < NUL 2>&1"
if ($LASTEXITCODE -ne 0) { Write-Host "[失败] 签名"; exit 1 }
$sigPath = "$exe.sig"
if (-not (Test-Path $sigPath)) { Write-Host "[失败] .sig 未生成"; exit 1 }
Write-Host "[2/5] 签名完成: $sigPath"
# 3. 生成 latest.json(UTF-8 无 BOM,防 PS5.1 BOM 坑)
$sig = (Get-Content $sigPath -Raw).Trim()
$pubDate = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
$latestJson = [ordered]@{
version = "0.1.3"
notes = $notes
pub_date = $pubDate
platforms = [ordered]@{
"windows-x86_64" = [ordered]@{
signature = $sig
url = "$baseUrl/devflow_0.1.3_x64-setup.exe"
}
}
} | ConvertTo-Json -Depth 5
$latestPath = "$nsis\latest.json"
[System.IO.File]::WriteAllText($latestPath, $latestJson, (New-Object System.Text.UTF8Encoding($false)))
Write-Host "[3/5] latest.json 已生成 (version=0.1.3)"
# 4. 上传三件套
$env:MSYS_NO_PATHCONV = "1"
ssh-proxy exec -n $site -c "mkdir -p $remoteDir"
foreach ($f in @($exe, $sigPath, $latestPath)) {
$name = Split-Path $f -Leaf
Write-Host "[4/5] 上传 $name ..."
ssh-proxy upload --name $site --src $f --dst "$remoteDir/$name"
if ($LASTEXITCODE -ne 0) { Write-Host "[失败] 上传 $name"; exit 1 }
}
# 5. 远端验证
Write-Host "[5/5] 远端清单验证:"
ssh-proxy exec -n $site -c "ls -la $remoteDir | grep 0.1.3; head -c 200 $remoteDir/latest.json"
Write-Host ""
Write-Host "[发布完成] v0.1.3 清单地址: $baseUrl/latest.json"