CI/CD for a Tauri App with GitHub Actions
Cross-compile and bundle your Tauri desktop app on macOS, Windows, and Linux.
Tauri pairs a web frontend with a Rust backend to produce small native desktop installers. Because installers are OS-specific, the build runs on a matrix of operating systems. This recipe builds and publishes per-platform artifacts.
What the pipeline does
- run on a macOS, Windows, and Linux matrix
- install system deps on Linux
- install Rust and Node
- build the frontend and bundle with tauri-action
- attach installers to a release
The workflow
tauri-apps/tauri-action builds the app and uploads the per-OS bundles. Linux needs webkit2gtk and related libraries installed first.
name: Release
on:
push:
tags: ['v*']
jobs:
build:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: 'App ${{ github.ref_name }}'Caching and speed
Cache the Cargo registry and target directory with Swatinem/rust-cache, plus cache: npm for the frontend. Rust release builds are CPU-heavy and run three times across the matrix, so faster, cheaper managed runners such as Latchkey (around 69% cheaper than GitHub-hosted) noticeably cut total release time and auto-retry transient toolchain fetches.
Deploying
tauri-action attaches .dmg, .msi, .deb, and .AppImage bundles to a GitHub Release. For auto-updates, sign the bundles and publish the updater JSON Tauri expects. Code signing requires platform certificates supplied as secrets.
Key takeaways
- Build on an OS matrix so each platform gets a native installer.
- Install webkit2gtk and GTK dev libs on Linux.
- Cache Cargo and node_modules to tame slow Rust builds.