- pubkey: rotated to the keypair stored at C:\Users\陈晨\.heicode-updater\heicode_updater.key (private side is the user's; only the pubkey ships in tauri.conf.json). - scripts/release-desktop.mjs: one-shot release helper — uploads the signed bundle artifacts to Azure Blob (account heicodeblob, container msi, public-blob-read) and rewrites website/public/updater/latest.json to point at the new URLs. - UPDATER.md: rewritten with the concrete URLs, container, key paths, and step-by-step commands. No more generic placeholders. Azure Blob setup (done out-of-band, not in this commit): - Storage account heicodeblob set allowBlobPublicAccess=true - Container msi set to public-blob read - Smoke-tested: https://heicodeblob.blob.core.windows.net/msi/<x> returns 200 anonymously. The actual Azure connection string + private-key path live in scripts/.env.release, which is gitignored under .env.* and was verified excluded before this commit. NOTE: pubkey was rotated. Any MSI already in the wild signed by the *previous* key cannot self-update to this signing chain — those users need a fresh manual install. This is acceptable for pre-GA where no public release exists yet. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4.3 KiB
4.3 KiB
Desktop 自动更新发版手册
客户端 UI(
UpdateChecker.tsx+updateStore.ts)已经在 AppShell 里挂好。本文只讲每次发版怎么把新版本喂进去。
当前已配置的资源
| 资源 | 值 |
|---|---|
更新清单 URL(写在 tauri.conf.json) |
https://ashy-dune-0e22d7b00.7.azurestaticapps.net/updater/latest.json |
| MSI/DMG 托管 | Azure Blob,account heicodeblob,容器 msi(公共只读) |
| 公共下载 URL 模板 | https://heicodeblob.blob.core.windows.net/msi/desktop/<version>/<filename> |
Tauri 签名公钥(已在 tauri.conf.json) |
RWRkyA8Y1qnKt8KPVg5IDvieсFnv1aoeWMJRZjdRc5r7h41pEmLe3yb/ |
| 私钥位置(本地) | C:\Users\陈晨\.heicode-updater\heicode_updater.key |
| 凭证文件 | scripts/.env.release(已 gitignore,不要 commit) |
重要:私钥丢了等于不能再发更新。请把 C:\Users\陈晨\.heicode-updater\heicode_updater.key 和它的 .pub 文件复制一份到云盘/密码管理器/U 盘。
每次发版(一条命令搞定上传 + 清单)
第 1 步:改版本号
编辑两处,保持一致:
cc-haha/desktop/src-tauri/tauri.conf.json→"version": "0.1.1"cc-haha/desktop/package.json→"version": "0.1.1"
第 2 步:加载凭证 + 打包
PowerShell:
cd cc-haha\desktop
# 加载凭证(私钥路径 + Azure key)
Get-Content scripts\.env.release | ForEach-Object {
if ($_ -match '^([^#=]+)=(.*)$') {
[Environment]::SetEnvironmentVariable($Matches[1].Trim(), $Matches[2].Trim(), 'Process')
}
}
# 把私钥文件内容塞进 TAURI_SIGNING_PRIVATE_KEY(tauri 期望的是内容而不是路径)
$env:TAURI_SIGNING_PRIVATE_KEY = Get-Content $env:TAURI_SIGNING_PRIVATE_KEY_PATH -Raw
bun run tauri build
产物(Windows):
src-tauri/target/release/bundle/nsis/heicode_0.1.1_x64-setup.exesrc-tauri/target/release/bundle/nsis/heicode_0.1.1_x64-setup.exe.sig← 自动产生的签名
Mac 类似,产物在 bundle/macos/。
第 3 步:跑发布脚本(上传 + 生成清单)
node scripts\release-desktop.mjs `
--notes "0.1.1 修复了 X,新增了 Y" `
--windows-x86_64 src-tauri\target\release\bundle\nsis\heicode_0.1.1_x64-setup.exe
脚本会:
- 把
.exe+.exe.sig传到https://heicodeblob.blob.core.windows.net/msi/desktop/0.1.1/ - 把
website/public/updater/latest.json改写成指向这次的 URL + 嵌入签名
mac 同时有产物的话:
node scripts\release-desktop.mjs `
--notes "0.1.1 ..." `
--windows-x86_64 src-tauri\target\release\bundle\nsis\heicode_0.1.1_x64-setup.exe `
--darwin-aarch64 src-tauri\target\release\bundle\macos\Heicode_aarch64.app.tar.gz
第 4 步:把清单 push 到 website 触发 Azure SWA 重新部署
cd ..\..\website
git add public\updater\latest.json
git commit -m "release: desktop 0.1.1"
git push # Azure SWA 自动重新部署,~1 分钟生效
部署完后:所有装着旧版本的用户下次启动 5 秒后会看到右上角弹窗"有更新可用"。
怎么验证有没有跑通
- 浏览器打开
https://ashy-dune-0e22d7b00.7.azurestaticapps.net/updater/latest.json—— 应能看到 JSON。 - 浏览器打开
platforms.windows-x86_64.url—— 应能直接下载 MSI。 - 装一个比 manifest 里
version旧的 Heicode 客户端,启动 5 秒后看右上角。
万一出问题
- 手动触发检查:客户端 Settings 页 → 检查更新。
- 看更新报错:
updateStore.error在 React DevTools 能看到;常见错误:signature mismatch(私钥换了但用户客户端里还嵌着旧 pubkey)、404(manifest URL 错)。 - 私钥泄漏 / 想换:重新跑
bun x tauri signer generate,更新tauri.conf.json的pubkey,重发一次 MSI。所有装着旧版本的用户都得手动重装这一版才能继续走自动更新通道。
⚠ pubkey 已经换过一次
本文档创建时,原仓库里的 pubkey 已被替换为 C:\Users\陈晨\.heicode-updater\heicode_updater.key 对应的公钥。如果在此之前已经分发过 MSI 给真实用户,那些用户的客户端没办法自动升级到新签名链 —— 必须给他们一个新 MSI 让他们手动安装一次,之后才能继续 OTA。