应用发布与在线更新流程。runtime 重建见 RUNTIME_BUILD.md。 本地开发环境准备见 DEVELOPMENT.md。
当前发布模型:
- 更新客户端只更新
exe - runtime 走整包发布,不走在线更新
- 更新服务器固定为
https://update.5051001.xyz/plotkitycat - 服务端只需要维护:
stable/manifest.jsonreleases/PlotKityCat-版本号-windows-amd64.exe
更新安装安全模型:
- 下载阶段校验 HTTPS、文件大小与 SHA-256
- 安装前再次校验下载文件,并在目标目录生成 Staged EXE
- Installer 完成 Ready Handshake 后,应用通过 Wails Graceful Shutdown 退出
- EXE 使用 Windows
MoveFileExAtomic Replace - 新进程在 Startup Health Window 内退出时,Installer 自动 Rollback 并重启旧版本
config/updates/state.json使用 Atomic File Write,失败后保留重试状态
runtime 约定:
resources/runtime/runtime.7z作为 release asset 外部分发- 当前使用的资产名是
runtime.7z - 从零重建流程见 RUNTIME_BUILD.md
编辑:
把 appVersion 改成要发布的版本,例如:
{
"appVersion": "0.0.3.1"
}相关脚本如果不手动传 -Version,都会默认读取这里的 appVersion:
tools/build-versioned-app.ps1tools/prepare-update-release.ps1tools/package-release.ps1
在仓库根目录运行:
powershell -ExecutionPolicy Bypass -File .\tools\build-versioned-app.ps1或者显式指定版本:
powershell -ExecutionPolicy Bypass -File .\tools\build-versioned-app.ps1 -Version 0.0.3.1产物:
build/bin/PlotKityCat.exebuild/bin/build-metadata.json
后续发布脚本会核对 build-metadata.json 与目标版本;版本不一致时直接终止,防止旧 EXE 被包装成新版本。
运行:
powershell -ExecutionPolicy Bypass -File .\tools\prepare-update-release.ps1或者:
powershell -ExecutionPolicy Bypass -File .\tools\prepare-update-release.ps1 -Version 0.0.3.1产物目录:
build/update
对应版本目录里会生成:
PlotKityCat-0.0.3.1-windows-amd64.exemanifest.json
说明:
manifest.json会自动写入下载地址和 sha256manifest.json会写入 EXE 字节数,客户端下载时同时校验- 默认下载地址前缀是
https://update.5051001.xyz/plotkitycat/releases
运行:
powershell -ExecutionPolicy Bypass -File .\tools\package-release.ps1或者:
powershell -ExecutionPolicy Bypass -File .\tools\package-release.ps1 -Version 0.0.3.1产物:
- 便携目录:
build/release/PlotKityCat-v0.0.3.1 - 压缩包:
build/release/PlotKityCat-v0.0.3.1.zip
说明:
- 这个 zip 会包含
PlotKityCat.exe、resources/runtime/runtime.7z、resources/runtime/7zip/和Scripts/ - 这个 zip 还会包含
resources/screeningzoom/zoomit.exe - 因此发布完整包前,必须先在本地准备好
resources/runtime/runtime.7z - 并且必须准备好
zoomit.exe;推荐固定放在resources/screeningzoom/zoomit.exe - 当前推荐先按 RUNTIME_BUILD.md 用裁剪开关重建 runtime,再执行完整打包
- 在线更新仍只替换 EXE;新增或调整
Scripts/、Runtime、ScreeningZoom 时,必须同步发布完整 zip
package-release.ps1 对 zoomit.exe 的查找顺序固定为:
resources/screeningzoom/zoomit.exethirdparty/screeningzoom/build/Release/zoomit.exethirdparty/screeningzoom/build/zoomit.exe
如果三处都没有,脚本会直接失败,不再生成缺失放映工具的发布包。
服务器:
root@149.28.135.102
更新文件目录:
/var/www/update.5051001.xyz/plotkitycat/releases//var/www/update.5051001.xyz/plotkitycat/stable/
先上传版本 exe:
scp .\build\update\0.0.3.1\PlotKityCat-0.0.3.1-windows-amd64.exe root@149.28.135.102:/var/www/update.5051001.xyz/plotkitycat/releases/再上传 manifest:
scp .\build\update\0.0.3.1\manifest.json root@149.28.135.102:/var/www/update.5051001.xyz/plotkitycat/stable/manifest.json注意:
- 先传 exe,再覆盖
stable/manifest.json - 因为客户端一旦读到新的 manifest,就会按里面的 URL 去下载 exe
本机先验证 manifest:
curl.exe -I https://update.5051001.xyz/plotkitycat/stable/manifest.json再验证 exe:
curl.exe -I https://update.5051001.xyz/plotkitycat/releases/PlotKityCat-0.0.3.1-windows-amd64.exe如果都返回 200 OK,说明更新源可用。
仅记录最短发布顺序:
- 改 version.json 的
appVersion - 执行
.\tools\build-versioned-app.ps1 - 执行
.\tools\prepare-update-release.ps1 - 执行
.\tools\package-release.ps1 - 上传
build/update/版本号/里的exe - 把
build/update/版本号/manifest.json覆盖到服务器stable/manifest.json
Updater 修复会从安装了新 Updater 的版本开始生效。旧版本升级到首个修复版本时,安装动作仍由旧 Updater 执行。
安全发布顺序:
- 首个修复版本优先发布完整 zip
- 确认用户运行的 EXE 已包含新 Updater
- 后续版本再验证 Check → Download → Graceful Restart → Health Check → Cleanup
- 验证成功后更新
stable/manifest.json
- 更新 manifest 地址:
https://update.5051001.xyz/plotkitycat/stable/manifest.json - 更新 exe 文件名格式:
PlotKityCat-版本号-windows-amd64.exe - 完整发布包目录格式:
build/release/PlotKityCat-v版本号 - 完整发布包 zip 格式:
build/release/PlotKityCat-v版本号.zip - runtime release 页面格式:
https://github.com/Wing900/PlotKityCat/releases/tag/v版本号 - runtime 下载地址格式:
https://github.com/Wing900/PlotKityCat/releases/download/v版本号/runtime.7z - 当前示例:
https://github.com/Wing900/PlotKityCat/releases/download/v0.0.3.1/runtime.7z
只需要:
- 改
version.json - 执行
.\tools\build-versioned-app.ps1 - 执行
.\tools\package-release.ps1
这样会得到完整 zip,但不会更新服务器上的在线更新入口。
会自动读取 version.json 里的 appVersion。
固定读:
https://update.5051001.xyz/plotkitycat/stable/manifest.json
因为 manifest 一更新,旧版本客户端就可能立刻看到新版本;如果这时 exe 还没上传完,下载会失败。
以下产物目录已在 .gitignore 中排除:
build/bin/build/release/build/update/