apps/tauri/AUTOUPDATER.md
This document explains how to use the autoupdater in Spacedrive's Tauri app.
The following has been configured:
tauri-plugin-updater added to Cargo.tomlcreateUpdaterArtifacts: true enables update artifact generationtauri.conf.jsonupdater:default permission added to capabilitiesmain.rsBefore building releases, you need to generate cryptographic signing keys:
cd apps/tauri
bun run tauri signer generate -- -w ~/.tauri/spacedrive.key
This creates two files:
~/.tauri/spacedrive.key - PRIVATE KEY (keep secret, never commit)~/.tauri/spacedrive.key.pub - Public key for verification~/.tauri/spacedrive.key.pubREPLACE_WITH_PUBLIC_KEY_FROM_GENERATION in tauri.conf.json with the public keyBefore building releases, set the private key:
macOS/Linux:
export TAURI_SIGNING_PRIVATE_KEY="$(cat ~/.tauri/spacedrive.key)"
bun run tauri build
Windows PowerShell:
$env:TAURI_SIGNING_PRIVATE_KEY = Get-Content ~/.tauri/spacedrive.key -Raw
bun run tauri build
GitHub Actions: Add the private key as a secret and use it in your workflow:
- name: Build with updater
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
run: bun run tauri build
The updater is configured to check:
https://releases.spacedrive.com/{{target}}/{{arch}}/{{current_version}}
Variables:
{{target}} - OS name (linux, windows, darwin){{arch}} - Architecture (x86_64, aarch64, i686, armv7){{current_version}} - Current app versionYour server should return JSON in one of these formats:
No update available:
HTTP 204 No Content
Update available:
{
"version": "2.0.1",
"notes": "Bug fixes and performance improvements",
"pub_date": "2026-01-25T00:00:00Z",
"platforms": {
"darwin-x86_64": {
"signature": "[content of .sig file]",
"url": "https://releases.spacedrive.com/Spacedrive_2.0.1_x64.app.tar.gz"
},
"darwin-aarch64": {
"signature": "[content of .sig file]",
"url": "https://releases.spacedrive.com/Spacedrive_2.0.1_aarch64.app.tar.gz"
},
"windows-x86_64": {
"signature": "[content of .sig file]",
"url": "https://releases.spacedrive.com/Spacedrive_2.0.1_x64-setup.nsis.zip"
},
"linux-x86_64": {
"signature": "[content of .sig file]",
"url": "https://releases.spacedrive.com/spacedrive_2.0.1_amd64.AppImage.tar.gz"
}
}
}
After building with createUpdaterArtifacts: true, you'll find:
*.app.tar.gz + *.app.tar.gz.sig*-setup.nsis.zip + *-setup.nsis.zip.sig*.AppImage.tar.gz + *.AppImage.tar.gz.sigUpload these to your release server along with the JSON manifest.
import { check } from '@tauri-apps/plugin-updater';
import { relaunch } from '@tauri-apps/plugin-process';
async function checkForUpdates() {
try {
const update = await check();
if (update === null) {
console.log('App is up to date');
return;
}
console.log(`Update available: ${update.version}`);
console.log(`Release notes: ${update.body}`);
// Download and install
let downloaded = 0;
let contentLength = 0;
await update.downloadAndInstall((event) => {
switch (event.event) {
case 'Started':
contentLength = event.data.contentLength;
console.log(`Starting download of ${contentLength} bytes`);
break;
case 'Progress':
downloaded += event.data.chunkLength;
console.log(`Downloaded ${downloaded}/${contentLength}`);
break;
case 'Finished':
console.log('Download finished');
break;
}
});
console.log('Update installed, restarting app...');
await relaunch();
} catch (error) {
console.error('Update check failed:', error);
}
}
// Check on app startup
checkForUpdates();
// Or add a manual check button
document.getElementById('check-updates')?.addEventListener('click', checkForUpdates);
Add a Tauri command for manual update checks:
use tauri_plugin_updater::UpdaterExt;
#[tauri::command]
async fn check_for_updates(app: tauri::AppHandle) -> Result<String, String> {
match app.updater()?.check().await {
Ok(Some(update)) => {
tracing::info!("Update available: {}", update.version);
// Download and install
update.download_and_install(
|chunk_length, content_length| {
tracing::debug!("Downloaded {chunk_length} of {content_length:?}");
},
|| tracing::info!("Download finished"),
).await
.map_err(|e| format!("Failed to download update: {}", e))?;
Ok(format!("Update to version {} installed", update.version))
}
Ok(None) => Ok("App is up to date".to_string()),
Err(e) => Err(format!("Update check failed: {}", e)),
}
}
// Register the command in main.rs
.invoke_handler(tauri::generate_handler![
check_for_updates,
// ... other commands
])
~/.tauri/spacedrive.key)tauri.conf.json is safe to commitbun run tauri buildtauri.conf.json and Cargo.tomlIf using GitHub Releases, consider using the tauri-action workflow:
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
with:
tagName: v__VERSION__
releaseName: 'Spacedrive v__VERSION__'
releaseBody: 'See the changelog for details'
releaseDraft: true
prerelease: false
This automatically:
Configure your endpoint to point to GitHub releases or use a CDN mirror.