name: Desktop Release
on:
push:
branches: [main]
tags:
- 'v*'
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build-tauri:
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
args: '--target universal-apple-darwin'
- platform: ubuntu-22.04
args: ''
- platform: windows-latest
args: ''
runs-on: ${{ matrix.platform }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- 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
- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install Linux deps
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
patchelf \
build-essential \
libssl-dev \
libgtk-3-dev \
libappindicator3-dev \
- name: Install frontend deps
run: npm ci --prefix frontend
- name: Build frontend (before tauri-action)
run: npm --prefix frontend run build
- name: Build service binaries (with target-triple suffix for Tauri)
shell: bash
run: |
# Determine the target triple Tauri expects
if [[ "${{ matrix.platform }}" == "macos-latest" ]]; then
# macOS builds both arches then merges into universal binaries
for triple in aarch64-apple-darwin x86_64-apple-darwin; do
cargo build --release --target "$triple" --bin spool --bin spool-mcp --bin spool-daemon
done
mkdir -p src-tauri/binaries
for bin in spool spool-mcp spool-daemon; do
lipo -create \
"target/aarch64-apple-darwin/release/$bin" \
"target/x86_64-apple-darwin/release/$bin" \
-output "src-tauri/binaries/$bin-universal-apple-darwin"
chmod +x "src-tauri/binaries/$bin-universal-apple-darwin"
done
else
cargo build --release --bin spool --bin spool-mcp --bin spool-daemon
triple=$(rustc -vV | sed -n 's|host: ||p')
mkdir -p src-tauri/binaries
for bin in spool spool-mcp spool-daemon; do
src="target/release/$bin"
ext=""
if [[ "${{ matrix.platform }}" == "windows-latest" ]]; then
ext=".exe"
src="target/release/$bin.exe"
fi
cp "$src" "src-tauri/binaries/$bin-$triple$ext"
if [[ "${{ matrix.platform }}" != "windows-latest" ]]; then
chmod +x "src-tauri/binaries/$bin-$triple$ext"
fi
done
fi
- name: Disable beforeBuildCommand in tauri.conf.json (CI builds frontend separately)
shell: bash
run: |
# tauri-action runs in src-tauri/ but its npm --prefix ../frontend
# path resolution doesn't match the GitHub Actions checkout layout.
# We pre-build the frontend ourselves above, so blank these out.
node -e "
const fs = require('fs');
const path = 'src-tauri/tauri.conf.json';
const cfg = JSON.parse(fs.readFileSync(path, 'utf8'));
cfg.build.beforeBuildCommand = '';
cfg.build.beforeDevCommand = '';
fs.writeFileSync(path, JSON.stringify(cfg, null, 2));
"
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: src-tauri
tagName: ${{ github.ref_name }}
releaseName: 'Spool Desktop __VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
ci-smoke:
if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/rust-cache@v2
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: frontend/package-lock.json
- name: Install Linux deps
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
patchelf \
build-essential \
libssl-dev \
libgtk-3-dev \
libappindicator3-dev
- name: cargo test
run: cargo test --workspace --all-features -q
- name: npm install
run: npm ci --prefix frontend
- name: typecheck
run: npm --prefix frontend run typecheck
- name: build frontend
run: npm --prefix frontend run build