tauri-deployment-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTauri Deployment Setup — Development Guide
Tauri部署搭建——开发指南
You are an expert on Tauri deployment pipelines. Use this knowledge when setting up CI/CD, configuring code signing, or integrating with the Oasis update server.
您是Tauri部署流水线方面的专家。在搭建CI/CD、配置代码签名或集成Oasis更新服务器时,请运用这些知识。
What It Is
系统介绍
A comprehensive deployment system for Tauri desktop applications that handles multi-platform builds, code signing, artifact storage, and automatic updates.
Reusable workflow:
This project's workflow:
porkytheblack/oasis/.github/workflows/tauri-release.yml@main.github/workflows/release.yaml这是一套针对Tauri桌面应用的完整部署系统,可处理多平台构建、代码签名、制品存储和自动更新。
可复用工作流:
本项目工作流:
porkytheblack/oasis/.github/workflows/tauri-release.yml@main.github/workflows/release.yamlArchitecture at a Glance
架构概览
Developer pushes tag → GitHub Actions triggers
↓
┌─────────────────────┴─────────────────────┐
↓ ↓ ↓
macOS Build Windows Build Linux Build
(Apple signed) (optional sign) (AppImage)
↓ ↓ ↓
└─────────────────────┬─────────────────────┘
↓
Tauri Update Signing
↓
┌─────────────────────┼─────────────────────┐
↓ ↓ ↓
Upload to R2 Register with Oasis GitHub Release
(CDN storage) (update manifest) (user downloads)Developer pushes tag → GitHub Actions triggers
↓
┌─────────────────────┴─────────────────────┐
↓ ↓ ↓
macOS Build Windows Build Linux Build
(Apple signed) (optional sign) (AppImage)
↓ ↓ ↓
└─────────────────────┬─────────────────────┘
↓
Tauri Update Signing
↓
┌─────────────────────┼─────────────────────┐
↓ ↓ ↓
Upload to R2 Register with Oasis GitHub Release
(CDN storage) (update manifest) (user downloads)Quick Start
快速开始
1. Install dependencies
1. 安装依赖
bash
pnpm add -D @tauri-apps/clibash
pnpm add -D @tauri-apps/cli2. Generate signing keys
2. 生成签名密钥
bash
npx @tauri-apps/cli signer generate -w ~/.tauri/keys/your-app.keybash
npx @tauri-apps/cli signer generate -w ~/.tauri/keys/your-app.keySave the public key for tauri.conf.json
Save the public key for tauri.conf.json
Save the private key as TAURI_SIGNING_PRIVATE_KEY secret
Save the private key as TAURI_SIGNING_PRIVATE_KEY secret
undefinedundefined3. Create release workflow
3. 创建发布工作流
yaml
undefinedyaml
undefined.github/workflows/release.yaml
.github/workflows/release.yaml
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
release:
uses: porkytheblack/oasis/.github/workflows/tauri-release.yml@main
with:
app_slug: your-app
app_name: Your App
artifact_prefix: YourApp
app_dir: app
distribute_to: r2,oasis,github
secrets:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_R2_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
R2_BUCKET_NAME: ${{ secrets.R2_BUCKET_NAME }}
OASIS_SERVER_URL: ${{ secrets.OASIS_SERVER_URL }}
OASIS_CI_KEY: ${{ secrets.OASIS_CI_KEY }}
undefinedname: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
release:
uses: porkytheblack/oasis/.github/workflows/tauri-release.yml@main
with:
app_slug: your-app
app_name: Your App
artifact_prefix: YourApp
app_dir: app
distribute_to: r2,oasis,github
secrets:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_R2_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_R2_ACCESS_KEY_ID }}
CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
R2_BUCKET_NAME: ${{ secrets.R2_BUCKET_NAME }}
OASIS_SERVER_URL: ${{ secrets.OASIS_SERVER_URL }}
OASIS_CI_KEY: ${{ secrets.OASIS_CI_KEY }}
undefined4. Configure updater in tauri.conf.json
4. 在tauri.conf.json中配置更新器
json
{
"plugins": {
"updater": {
"pubkey": "YOUR_PUBLIC_KEY_HERE",
"endpoints": [
"https://oasis.yourdomain.com/{app_slug}/update/{{target}}-{{arch}}/{{current_version}}"
]
}
}
}json
{
"plugins": {
"updater": {
"pubkey": "YOUR_PUBLIC_KEY_HERE",
"endpoints": [
"https://oasis.yourdomain.com/{app_slug}/update/{{target}}-{{arch}}/{{current_version}}"
]
}
}
}5. Trigger release
5. 触发发布
bash
./app/scripts/bump-version.sh patch
git push && git push --tagsbash
./app/scripts/bump-version.sh patch
git push && git push --tagsVersion Files to Sync
需要同步的版本文件
| File | Format | Location |
|---|---|---|
| | App root |
| | src-tauri/ |
| | src-tauri/ |
| Status bar | | UI component |
Use to update all files automatically.
./app/scripts/bump-version.sh| 文件 | 格式 | 位置 |
|---|---|---|
| | 应用根目录 |
| | src-tauri/ |
| | src-tauri/ |
| 状态栏 | | UI组件 |
使用自动更新所有文件。
./app/scripts/bump-version.shDistribution Targets
分发目标
| Target | Purpose | When to Use |
|---|---|---|
| GitHub Releases page | User downloads, changelog |
| Cloudflare R2 CDN | Fast artifact delivery |
| Update server | Auto-update manifests |
Combine with comma:
distribute_to: r2,oasis,github| 目标 | 用途 | 使用场景 |
|---|---|---|
| GitHub Releases页面 | 用户下载、变更日志 |
| Cloudflare R2 CDN | 快速制品分发 |
| 更新服务器 | 自动更新清单 |
使用逗号分隔组合:
distribute_to: r2,oasis,githubRequired Secrets
所需密钥
Apple Code Signing (macOS)
Apple代码签名(macOS)
| Secret | Description |
|---|---|
| Base64-encoded .p12 certificate |
| Certificate password |
| e.g., "Developer ID Application: Your Name" |
| Apple ID email |
| App-specific password (not Apple ID password) |
| 10-character Team ID |
| 密钥 | 说明 |
|---|---|
| Base64编码的.p12证书 |
| 证书密码 |
| 例如:"Developer ID Application: Your Name" |
| Apple ID邮箱 |
| 应用专用密码(非Apple ID密码) |
| 10位团队ID |
Tauri Update Signing
Tauri更新签名
| Secret | Description |
|---|---|
| Private key from signer generate |
| Password used during generation |
| 密钥 | 说明 |
|---|---|
| 签名工具生成的私钥 |
| 生成时设置的密码 |
Cloudflare R2
Cloudflare R2
| Secret | Description |
|---|---|
| Account ID from dashboard |
| R2 API token ID |
| R2 API token secret |
| Bucket name |
| 密钥 | 说明 |
|---|---|
| 控制台中的账户ID |
| R2 API令牌ID |
| R2 API令牌密钥 |
| 存储桶名称 |
Oasis Server
Oasis服务器
| Secret | Description |
|---|---|
| e.g., |
| CI authentication key |
| 密钥 | 说明 |
|---|---|
| 例如: |
| CI认证密钥 |
Tauri Capabilities
Tauri权限
Add to :
capabilities/default.jsonjson
{
"permissions": [
"core:default",
"core:window:default",
"core:window:allow-start-dragging",
"shell:default",
"shell:allow-open",
"dialog:default",
"fs:default",
"http:default",
"updater:default",
"updater:allow-check",
"updater:allow-download-and-install",
"process:default",
"process:allow-restart"
]
}添加到:
capabilities/default.jsonjson
{
"permissions": [
"core:default",
"core:window:default",
"core:window:allow-start-dragging",
"shell:default",
"shell:allow-open",
"dialog:default",
"fs:default",
"http:default",
"updater:default",
"updater:allow-check",
"updater:allow-download-and-install",
"process:default",
"process:allow-restart"
]
}Release Commands (This Project)
发布命令(本项目)
| Action | Command |
|---|---|
| Bump patch | |
| Bump minor | |
| Bump major | |
| Set version | |
| Preview | |
| Push release | |
| Redeploy | |
| 操作 | 命令 |
|---|---|
| 升级补丁版本 | |
| 升级次版本 | |
| 升级主版本 | |
| 设置版本 | |
| 预览 | |
| 推送发布 | |
| 重新部署 | |
Common Gotchas
常见问题
- Apple signing identity must match exactly — Copy the full name from Keychain Access, including "Developer ID Application:" prefix.
- App-specific password, not Apple ID password — Generate at appleid.apple.com under Security → App-Specific Passwords.
- Public key mismatch — If updates fail signature verification, regenerate keys and update both and the GitHub secret.
tauri.conf.json - R2 public URL required — Set as a repository variable (not secret) for the CDN base URL.
R2_PUBLIC_URL - Version mismatch breaks updates — All version files must match. Use the bump script, not manual edits.
- Tag format matters — Workflow triggers on tags. Use
v*, notv0.1.0.0.1.0 - Workflow permissions — Ensure permission for creating GitHub releases.
contents: write - macOS notarization takes time — Apple notarization can take 5-15 minutes. Don't cancel the workflow early.
- Secrets are case-sensitive — Double-check secret names match exactly.
- Dry run first — Use with
workflow_dispatchto test without uploading.dry_run: true
- Apple签名身份必须完全匹配 — 从钥匙串访问中复制完整名称,包括"Developer ID Application:"前缀。
- 使用应用专用密码,而非Apple ID密码 — 在appleid.apple.com的“安全”→“应用专用密码”中生成。
- 公钥不匹配 — 如果更新签名验证失败,请重新生成密钥并同时更新和GitHub密钥。
tauri.conf.json - 需要R2公开URL — 将设置为仓库变量(非密钥),作为CDN基础URL。
R2_PUBLIC_URL - 版本不匹配会导致更新失败 — 所有版本文件必须一致。使用升级脚本,不要手动编辑。
- 标签格式很重要 — 工作流在标签时触发。使用
v*,而非v0.1.0。0.1.0 - 工作流权限 — 确保拥有权限以创建GitHub发布。
contents: write - macOS公证需要时间 — Apple公证可能需要5-15分钟。不要提前取消工作流。
- 密钥区分大小写 — 仔细检查密钥名称是否完全匹配。
- 先进行试运行 — 使用并设置
workflow_dispatch来测试,无需上传。dry_run: true