新增: 应用内版本更新与自动升级全链路

后端 update.rs: app_check_update(拉 latest.json+ed25519 签名校验) /
app_download_install_update / prefs 读写 / mark_checked / mark_notified 五命令,
lib.rs 注册;tauri.conf updater 段(endpoints=app.1216.top/download/devflow/latest.json
+ pubkey + createUpdaterArtifacts) + tauri-plugin-updater 依赖 + capabilities 权限。

前端 UpdateBadge.vue(顶栏徽章+下拉) / useUpdateCheck.ts(检查/下载/安装状态机) /
AboutPanel.vue(设置页关于面板) + AppLayout 接线 + SettingsNav/searchIndex 索引 +
i18n zh/en settings 键。

运维 scripts/publish-release.ps1(发版) + swap-install.ps1(换装校验) +
设计文档 版本更新与自动升级-设计-2026-10-09.md。

验收: cargo check -p devflow EXIT 0 + vue-tsc EXIT 0 + build EXIT 0。
This commit is contained in:
lxy
2026-10-09 22:53:14 +08:00
parent c70faa7bb8
commit a8c92e9619
27 changed files with 2021 additions and 24 deletions
+43
View File
@@ -0,0 +1,43 @@
# DevFlow 换装脚本:kill 旧进程 -> 静默安装 -> 启动验证
# 独立后台执行,避免中断当前会话导致换装半途而废
$ErrorActionPreference = 'Continue'
$log = 'E:/wk-lab/devflow/swap.log'
function Log($m) { "$(Get-Date -Format 'HH:mm:ss') $m" | Tee-Object -FilePath $log -Append }
Log "=== 换装开始 ==="
# 1. kill 旧进程
$procs = Get-Process devflow -ErrorAction SilentlyContinue
if ($procs) {
Log "发现运行中 devflow 进程: $($procs.Id -join ','),正在结束..."
$procs | Stop-Process -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 3
$still = Get-Process devflow -ErrorAction SilentlyContinue
if ($still) { Log "警告: 仍有残留进程 $($still.Id -join ',')"; $still | Stop-Process -Force -ErrorAction SilentlyContinue; Start-Sleep -Seconds 2 }
Log "旧进程已结束"
} else {
Log "无运行中 devflow 进程"
}
# 2. 静默安装新包
$setup = 'E:/wk-lab/devflow/target/release/bundle/nsis/devflow_0.1.1_x64-setup.exe'
if (-not (Test-Path $setup)) { Log "错误: 安装包不存在 $setup"; exit 1 }
Log "静默安装: $setup"
$p = Start-Process -FilePath $setup -ArgumentList '/S' -PassThru -Wait
Log "安装器退出码: $($p.ExitCode)"
Start-Sleep -Seconds 3
# 3. 启动验证
$installed = 'C:\Users\23780\AppData\Local\devflow\devflow.exe'
if (Test-Path $installed) {
$ver = (Get-Item $installed).VersionInfo.FileVersion
Log "已安装二进制: $installed (FileVersion=$ver)"
Start-Process -FilePath $installed
Start-Sleep -Seconds 5
$new = Get-Process devflow -ErrorAction SilentlyContinue
if ($new) { Log "启动成功, PID=$($new.Id -join ',')" } else { Log "警告: 启动后未检测到进程" }
} else {
Log "警告: 未找到安装后二进制 $installed"
}
Log "=== 换装结束 ==="