打包
使用 Tauri 为 Windows、macOS 与 Linux 构建安装包。
桌面应用的 deployment 是发布 installers;若启用更新,还要托管 signed update feed,并不是部署一个
web app。Tauri bundle settings 位于 src-tauri/tauri.conf.json,macOS window override 位于
src-tauri/tauri.macos.conf.json。
构建 release
pnpm tauri build # 编译并创建当前平台的 installers
pnpm tauri build --no-bundle # 只编译 release app,不创建 installer两者都需要数分钟,因为会构建 frontend 与 Rust binary。请在重要里程碑使用 --no-bundle,然后在
每个要发布的平台上运行完整命令。artifacts 位于 src-tauri/target/release/bundle/。请在对应 OS 或
匹配的 CI runner 上构建平台 installers。
根 config 提供 product name、version、reverse-DNS identifier、默认 frameless window、bundle
publisher、homepage、icon list 和 createUpdaterArtifacts: true。它请求 NSIS、MSI、DMG、AppImage、
deb、rpm;每个 runner 只生成自身支持的 targets。
Windows 创建 NSIS 与 MSI bundles。NSIS 按 current user 安装,使用 LZMA compression,并可在需要时 下载 WebView2 bootstrapper。config 会阻止 downgrade,并使用 SHA-256 timestamps。
macOS 创建 DMG。bundle 要求 macOS 11 或更新版本,并启用 hardened runtime。macOS override 会将 main window 切换为 overlay titlebar,同时保留应用的 custom controls。
Linux 创建 AppImage、deb、rpm。只有 AppImage 可由内置 updater 更新;deb/rpm 用户需通过 package manager 或手动下载更新。
签名与公证
没有 credentials 的本地或 fork build 仍然有用:未设置 signing variables 时会产出 unsigned output。
发布时请把这些值放在 CI secrets 中,绝不要放进 .env 或 repository。
| 平台 | Credentials | 发布说明 |
|---|---|---|
| Windows | WINDOWS_CERTIFICATE、WINDOWS_CERTIFICATE_PASSWORD | 签名用于识别 publisher;新应用在积累 reputation 前仍可能出现 SmartScreen warning。 |
| macOS | APPLE_ID、APPLE_PASSWORD、APPLE_TEAM_ID、APPLE_CERTIFICATE、APPLE_CERTIFICATE_PASSWORD、APPLE_SIGNING_IDENTITY | 发布 build 应签名并 notarize。未签名下载可能被 Gatekeeper 阻止或报告为 damaged。 |
| Linux | 默认无需 | Linux packages 通常不签名。 |
updater signing 与平台 code signing 是独立的:release builds 还需要
TAURI_SIGNING_PRIVATE_KEY,若受保护还需要 TAURI_SIGNING_PRIVATE_KEY_PASSWORD。public
verification key 放在 tauri.conf.json,private key 永远不能放进去。参见
Auto-Update。
Icons
使用 square PNG(建议 1024×1024)生成 application icon set:
pnpm tauri icon path/to/icon.png该命令会重建 src-tauri/icons/,包含 .icns、.ico、Linux PNGs 与 Windows tile assets。tray art
是独立的:按 docs/APP_ICONS.md 更新 source mark 和 resources/build/tray/ 中的 derived PNGs,
然后在真实 build 中检查 dock/taskbar、installer 与 tray icons。
发布前验证
运行模板的完整质量门:
pnpm format:check && pnpm lint:check && pnpm typecheck && pnpm test:unit
cargo fmt --check --manifest-path src-tauri/Cargo.toml
cargo clippy --manifest-path src-tauri/Cargo.toml -- -D warnings
cargo test --manifest-path src-tauri/Cargo.toml.github/workflows/ci.yml 会在 Linux、macOS、Windows 上运行该 gate,检查 generated Specta binding
drift,并执行 pnpm tauri build --no-bundle。独立的 WebdriverIO + tauri-driver smoke harness 位于
test/e2e/,带自己的 package.json:支持 Linux/Windows,没有 macOS backend;CI 只在 push 到
main 时执行它,不作为 PR gate。
