Tauri Skill
🤖 AI Integration Guide: Send this page link to AI for automatic integration guidance
Quick Information
- Application Type: Tauri
- Skill Version: 2.0.0
- Integration Difficulty: ⭐⭐ (Easy)
- Estimated Time: 10-30 minutes
📖 Integration Scenarios
Choose the appropriate integration method based on your project type:
| Scenario | Suitable For | Features | Estimated Time |
|---|---|---|---|
| Scenario 1 | Non-open source, Private projects | Manual build & upload, Data reporting | 10 minutes |
| Scenario 2 | Open source projects | GitHub Actions automated build & release | 30 minutes |
Scenario 1: Non-Open Source Project Integration
Suitable for private projects or projects that don't require GitHub Actions automated deployment.
1. Install Plugin
Use the official Tauri recommended command to install the updater plugin:
npm run tauri add updaterThis command automatically:
- Installs
@tauri-apps/plugin-updaterdependency - Installs
@tauri-apps/plugin-processdependency (for app restart) - Configures necessary permissions
For manual installation, execute separately:
npm install @tauri-apps/plugin-updater
npm install @tauri-apps/plugin-process2. Generate Signing Keys
Tauri updates require signing keys to verify the integrity of update packages. You need to generate a key pair (public key and private key).
Generate Keys
Run the following command in your project root directory:
npm run tauri signer generate -- -w ./.tauri/tauri.keyYou will be prompted to enter a password (to protect the private key), and two files will be generated:
.tauri/tauri.key- Private key (used to sign update packages, keep it safe and do not commit to the repository).tauri/tauri.key.pub- Public key (used to verify update packages in the application)
View Public Key Content
cat .tauri/tauri.key.pubOutput example:
dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDY4QjBGNEM4NjUyMUNGRjAKUldUd3p5Rmx5UFN3YUN1UkFMK05DdWR4VjA1eDRybkxJNzMreURNbHZ4VFhtSk54UTVMWVg4NnAKConfigure Environment Variables
When building update packages, you need to set the following environment variables:
# Mac/Linux
export TAURI_SIGNING_PRIVATE_KEY=$(cat .tauri/tauri.key)
export TAURI_SIGNING_PRIVATE_KEY_PASSWORD=your_password
# Windows (PowerShell)
$env:TAURI_SIGNING_PRIVATE_KEY = Get-Content .tauri/tauri.key -Raw
$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = "your_password"⚠️ Security Tips:
- Add the private key file
.tauri/tauri.keyto.gitignore, do not commit to the repository - Use environment variables or secret management services in CI/CD to store the private key
- The public key can be made public and used to configure the application
3. Configure tauri.conf.json
Configure the update plugin in src-tauri/tauri.conf.json:
{
"bundle": {
"createUpdaterArtifacts": true
},
"plugins": {
"updater": {
"pubkey": "your_generated_public_key_content",
"endpoints": [
"https://api.upgrade.toolsetlink.com/v1/tauri/upgrade?tauriKey=YOUR_TAURI_KEY&versionName={{current_version}}&appointVersionName=&devModelKey=&devKey=&target={{target}}&arch={{arch}}"
],
"windows": {
"installMode": "passive"
}
}
}
}Configuration Description:
| Field | Description |
|---|---|
createUpdaterArtifacts | Set to true to tell Tauri to create update packages |
pubkey | Public key content generated in Step 2 (not a file path) |
endpoints | UpgradeLink upgrade detection API address |
windows.installMode | Windows installation mode: passive (recommended), basicUi, quiet |
endpoints Parameters:
| Parameter | Description | Source |
|---|---|---|
tauriKey | UpgradeLink application identifier | Get from UpgradeLink dashboard |
versionName | Current application version | Auto-filled with |
target | Operating system | Auto-filled with |
arch | System architecture | Auto-filled with |
⚠️ Note:
- Replace
your_generated_public_key_contentwith the public key generated in Step 2 - Replace
YOUR_TAURI_KEYwith your actual Tauri Key
4. Add Update Check Code
Add the following code to your Tauri application:
import { check } from '@tauri-apps/plugin-updater';
import { relaunch } from '@tauri-apps/plugin-process';
async function checkForUpdates() {
try {
const update = await check({
timeout: 5000,
headers: {
'X-AccessKey': 'YOUR_ACCESS_KEY',
},
});
if (update) {
console.log(`New version ${update.version} available, released on ${update.date}`);
console.log(`Release notes: ${update.body}`);
let downloaded = 0;
let contentLength = 0;
await update.downloadAndInstall((event) => {
switch (event.event) {
case 'Started':
contentLength = event.data.contentLength;
console.log(`Download started, total size: ${contentLength} bytes`);
break;
case 'Progress':
downloaded += event.data.chunkLength;
console.log(`Download progress: ${downloaded} / ${contentLength}`);
break;
case 'Finished':
console.log('Download complete');
break;
}
});
console.log('Installation complete, restarting application');
await relaunch();
} else {
console.log('Already on the latest version');
}
} catch (error) {
console.error('Update check failed:', error);
}
}⚠️ Note: Replace YOUR_ACCESS_KEY with your actual Access Key
5. Set Permissions
Add permissions in src-tauri/capabilities/default.json:
{
"permissions": [
"updater:default",
"process:default"
]
}Permission Description:
| Permission | Description |
|---|---|
updater:default | Allow checking, downloading, and installing updates |
process:default | Allow restarting the application |
6. Data Reporting Integration
During the upgrade process, call the data reporting API to record upgrade status for data statistics and analysis.
Reporting Utility Functions
import crypto from 'crypto';
function generateSignature(timestamp: string, nonce: string, body: string, accessSecret: string): string {
const signStr = `timestamp=${timestamp}&nonce=${nonce}&body=${body}&accessSecret=${accessSecret}`;
return crypto.createHash('md5').update(signStr).digest('hex');
}
function generateNonce(length: number = 16): string {
return crypto.randomBytes(Math.ceil(length / 2)).toString('hex').slice(0, length);
}
async function reportEvent(
eventType: string,
appKey: string,
eventData: Record<string, any>,
accessKey: string,
accessSecret: string
): Promise<void> {
const timestamp = new Date().toISOString();
const nonce = generateNonce();
const body = JSON.stringify({
eventType,
timestamp,
appKey,
eventData,
});
const signature = generateSignature(timestamp, nonce, body, accessSecret);
try {
const response = await fetch('https://api.upgrade.toolsetlink.com/v1/app/report', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Timestamp': timestamp,
'X-Nonce': nonce,
'X-AccessKey': accessKey,
'X-Signature': signature,
},
body,
});
const result = await response.json();
console.log('Report result:', result);
} catch (error) {
console.error('Report failed:', error);
}
}Complete Upgrade Flow Example (with Data Reporting)
import { check } from '@tauri-apps/plugin-updater';
import { relaunch } from '@tauri-apps/plugin-process';
import { getVersion } from '@tauri-apps/api/app';
import { platform, arch } from '@tauri-apps/plugin-os';
let upgradeVersionCode = 0;
async function checkAndInstallUpdate() {
try {
const update = await check({
timeout: 5000,
headers: {
'X-AccessKey': 'YOUR_ACCESS_KEY',
},
});
if (update) {
console.log('New version available:', update.version);
upgradeVersionCode = parseInt(update.version.split('.').join(''));
let downloaded = 0;
let contentLength = 0;
await update.downloadAndInstall((event) => {
switch (event.event) {
case 'Started':
contentLength = event.data.contentLength || 0;
console.log(`Download started, total size: ${contentLength} bytes`);
break;
case 'Progress':
downloaded += event.data.chunkLength;
const percent = contentLength > 0 ? (downloaded / contentLength * 100).toFixed(1) : 'unknown';
console.log(`Download progress: ${percent}%`);
break;
case 'Finished':
console.log('Download complete');
reportDownload(upgradeVersionCode, 0);
break;
}
});
console.log('Installation complete, restarting application');
await reportUpgrade(upgradeVersionCode, 0);
await relaunch();
}
} catch (error) {
console.error('Update failed:', error);
if (upgradeVersionCode > 0) {
await reportDownload(upgradeVersionCode, 1);
await reportUpgrade(upgradeVersionCode, 1);
}
}
}
async function reportDownload(downloadVersionCode: number, code: number) {
const currentVersion = await getVersion();
const currentPlatform = await platform();
const currentArch = await arch();
await reportEvent(
'app_upgrade_download',
'YOUR_TAURI_KEY',
{
versionCode: parseInt(currentVersion.split('.').join('')),
downloadVersionCode,
code,
target: currentPlatform,
arch: currentArch,
},
'YOUR_ACCESS_KEY',
'YOUR_ACCESS_SECRET'
);
}
async function reportUpgrade(upgradeVersionCode: number, code: number) {
const currentVersion = await getVersion();
const currentPlatform = await platform();
const currentArch = await arch();
await reportEvent(
'app_upgrade_upgrade',
'YOUR_TAURI_KEY',
{
versionCode: parseInt(currentVersion.split('.').join('')),
upgradeVersionCode,
code,
target: currentPlatform,
arch: currentArch,
},
'YOUR_ACCESS_KEY',
'YOUR_ACCESS_SECRET'
);
}
async function reportAppStart() {
const currentVersion = await getVersion();
const currentPlatform = await platform();
const currentArch = await arch();
await reportEvent(
'app_start',
'YOUR_TAURI_KEY',
{
versionCode: parseInt(currentVersion.split('.').join('')),
launchTime: new Date().toISOString(),
target: currentPlatform,
arch: currentArch,
},
'YOUR_ACCESS_KEY',
'YOUR_ACCESS_SECRET'
);
}Status Code Reference
Download event code:
| Status Code | Description |
|---|---|
| 0 | Download successful |
| 1 | Download failed (general) |
| 1001 | HTTP error |
| 1002 | Insufficient space |
| 1003 | File operation error |
| 1004 | MD5 verification failed |
Upgrade event code:
| Status Code | Description |
|---|---|
| 0 | Upgrade successful |
| 1 | Upgrade failed |
📖 Detailed API Documentation: Event Reporting API
7. Manual Build and Upload
Build Update Packages
After setting environment variables, execute the build command:
npm run tauri buildGenerated Files
After the build completes, update packages will be generated in the following directories:
| Platform | Directory | Files |
|---|---|---|
| Linux | target/release/bundle/appimage/ | myapp.AppImage, myapp.AppImage.sig |
| macOS | target/release/bundle/macos/ | myapp.app.tar.gz, myapp.app.tar.gz.sig |
| Windows | target/release/bundle/msi/ | myapp.msi, myapp.msi.sig |
| Windows | target/release/bundle/nsis/ | myapp-setup.exe, myapp-setup.exe.sig |
Upload to UpgradeLink
- Log in to UpgradeLink dashboard
- Go to Application Management page
- Create a new version, upload the corresponding installation package and signature file
- Configure upgrade strategy
Scenario 2: Open Source Project Integration
Suitable for open source projects that require GitHub Actions automated build, release, and update.
1. Complete Basic Integration
First complete all steps (1-6) in Scenario 1.
2. Configure GitHub Secrets
Add the following encrypted environment variables in your GitHub repository's Settings > Security > Secrets and variables > Actions:
| Secret Name | Description | How to Get |
|---|---|---|
UPGRADE_LINK_ACCESS_KEY | UpgradeLink access key | UpgradeLink dashboard > Key Management |
UPGRADE_LINK_ACCESS_SECRET | UpgradeLink access secret | UpgradeLink dashboard > Key Management |
UPGRADE_LINK_TAURI_KEY | Tauri application unique identifier | UpgradeLink dashboard > Application Info |
TAURI_SIGNING_PRIVATE_KEY | Tauri signing private key | Private key content generated in Step 2 |
TAURI_SIGNING_PRIVATE_KEY_PASSWORD | Signing private key password | Password set in Step 2 |
3. Configure GitHub Actions Workflow
Create .github/workflows/publish.yml in your project root:
name: 'publish'
on:
push:
branches:
- main
jobs:
publish-tauri:
permissions:
contents: write
outputs:
appVersion: ${{ steps.set-job-output.outputs.appVersion }}
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest'
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'ubuntu-22.04-arm'
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: install dependencies (ubuntu only)
if: startsWith(matrix.platform, 'ubuntu-')
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'yarn'
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: install frontend dependencies
run: yarn install
- uses: tauri-apps/tauri-action@v0
id: tauri-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
tagName: ${{ github.event.repository.name }}-v__VERSION__
releaseName: '${{ github.event.repository.name }} v__VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: false
prerelease: false
args: ${{ matrix.args }}
- name: Set job output
id: set-job-output
if: matrix.platform == 'ubuntu-22.04'
run: |
echo "appVersion=${{ steps.tauri-action.outputs.appVersion }}" >> $GITHUB_OUTPUT
upgradeLink-upload:
needs: publish-tauri
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Send a request to UpgradeLink
uses: toolsetlink/upgradelink-action@3.0.2
with:
access_key: ${{ secrets.UPGRADE_LINK_ACCESS_KEY }}
access_secret: ${{ secrets.UPGRADE_LINK_ACCESS_SECRET }}
config: |
{
"app_type": "tauri",
"request": {
"app_key": "${{ secrets.UPGRADE_LINK_TAURI_KEY }}",
"latest_json_url": "https://github.com/${{ github.repository }}/releases/download/${{ github.event.repository.name }}-v${{ needs.publish-tauri.outputs.appVersion }}/latest.json"
}
}4. Workflow Details
publish-tauri Job
Function: Cross-platform build and publish to GitHub Releases
| Step | Description |
|---|---|
| Checkout code | actions/checkout@v4 |
| Install dependencies | Linux system dependencies, Node.js, Rust |
| Build cache | Rust compilation cache to speed up builds |
| Frontend dependencies | Install npm/yarn dependencies |
| Tauri build | Build using tauri-apps/tauri-action@v0 |
| Extract version | Output appVersion for later use |
Multi-platform Build Strategy:
| Platform | Runner | Target Architecture |
|---|---|---|
| macOS (M1+) | macos-latest | aarch64-apple-darwin |
| macOS (Intel) | macos-latest | x86_64-apple-darwin |
| Linux (x64) | ubuntu-22.04 | - |
| Linux (ARM) | ubuntu-22.04-arm | - |
| Windows | windows-latest | - |
upgradeLink-upload Job
Function: Sync update information to UpgradeLink platform
| Step | Description |
|---|---|
| Wait for build | Depends on publish-tauri completion |
| Get version | Retrieve from publish-tauri output |
| Upload info | Sync using upgradelink-action |
UpgradeLink Action Parameters:
| Parameter | Description |
|---|---|
access_key | UpgradeLink access key |
access_secret | UpgradeLink access secret |
app_type | Application type, fixed as tauri |
app_key | Tauri application unique identifier |
latest_json_url | latest.json address in GitHub Releases |
5. UpgradeLink Platform Configuration
Configure the GitHub repository address in UpgradeLink dashboard:
- Log in to UpgradeLink dashboard
- Go to Application Management > Tauri Application Details
- Fill in the repository address in the "GitHub Repository Address" field, e.g.:
https://github.com/username/repo-name - Save configuration
After configuration, UpgradeLink will automatically read the latest.json file from GitHub Releases.
6. Automated Process Description
When code is pushed to the main branch, the automated process is as follows:
Code Push
│
▼
┌─────────────────────────────────────────┐
│ publish-tauri Job │
│ ┌─────────────────────────────────┐ │
│ │ Parallel build for 5 platforms │ │
│ │ - macOS (M1) │ │
│ │ - macOS (Intel) │ │
│ │ - Linux (x64) │ │
│ │ - Linux (ARM) │ │
│ │ - Windows │ │
│ └─────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────┐ │
│ │ Create GitHub Release │ │
│ │ Upload packages & latest.json │ │
│ └─────────────────────────────────┘ │
└─────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ upgradeLink-upload Job │
│ ┌─────────────────────────────────┐ │
│ │ Read latest.json URL │ │
│ │ Call UpgradeLink API │ │
│ │ Auto-create version & strategy │ │
│ └─────────────────────────────────┘ │
└─────────────────────────────────────────┘
│
▼
Users receive update notification🤖 AI Integration
Send this page link to AI, for example:
Please help me integrate application upgrade, here's the Skill link:
https://www.toolsetlink.com/en/upgrade/skill/tauriAI will automatically:
- Identify the application type as Tauri
- Determine project type (open source/non-open source)
- Retrieve configuration information and code examples
- Guide you to replace placeholders (YOUR_TAURI_KEY, etc.)
- Verify configuration correctness
- Complete integration testing
📋 Complete Example
View complete example project: tauri-demo
❓ FAQ
Q: How to get Tauri Key?
A: Log in to UpgradeLink dashboard, create a Tauri application to obtain it.
Q: How to get Access Key and Access Secret?
A: Log in to UpgradeLink dashboard, obtain them from the key management page.
Q: What if update fails?
A: Check network connection and configuration, or contact AI for help.
Q: Will data reporting failure affect the upgrade process?
A: No. Data reporting is an asynchronous operation, failure will not affect the normal upgrade process. It is recommended to retry during off-peak hours.
Q: What if GitHub Actions build fails?
A:
- Check GitHub Actions logs for specific error information
- Confirm all dependencies are correctly installed, especially Linux platform system dependencies
- Ensure Rust and Node.js versions are compatible
- Check if GitHub Secrets are configured correctly
Q: How to test the update process?
A:
- Build and upload a lower version
- Modify code version number, build and upload a higher version
- Run the lower version application and check if it can detect the update
Q: Can I rollback to an older version?
A: Yes. Modify the upgrade strategy in UpgradeLink dashboard and specify the target version.