Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
workflow_dispatch:
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write
defaults:
run:
shell: bash
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
release_id: ${{ steps.create.outputs.release_id }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true
- name: Compute version
id: version
run: |
YY=$(date -u +%-y)
M=$(date -u +%-m)
PREFIX="v${YY}.${M}."
LATEST_REV=$(git tag --list "${PREFIX}*" --sort=-version:refname \
| head -n 1 \
| sed "s/^${PREFIX}//")
if [ -z "$LATEST_REV" ]; then
REVISION=1
else
REVISION=$((LATEST_REV + 1))
fi
VERSION="${YY}.${M}.${REVISION}"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Computed version: $VERSION"
- name: Create draft release
id: create
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
RELEASE_ID=$(gh api -X POST \
"repos/${GITHUB_REPOSITORY}/releases" \
-f tag_name="v${VERSION}" \
-f target_commitish="${GITHUB_SHA}" \
-f name="v${VERSION}" \
-F draft=true \
-F generate_release_notes=true \
--jq '.id')
if [ -z "$RELEASE_ID" ]; then
echo "Failed to create draft release" >&2
exit 1
fi
echo "release_id=$RELEASE_ID" >> "$GITHUB_OUTPUT"
echo "Created draft release $RELEASE_ID for v${VERSION}"
build:
needs: prepare
strategy:
fail-fast: false
matrix:
include:
- runner: macos-latest # Apple Silicon
target: aarch64-apple-darwin
args: --target aarch64-apple-darwin --bundles app,dmg
- runner: ubuntu-22.04
target: x86_64-unknown-linux-gnu
args: --target x86_64-unknown-linux-gnu --bundles deb,appimage
- runner: ubuntu-22.04-arm
target: aarch64-unknown-linux-gnu
args: --target aarch64-unknown-linux-gnu --bundles deb,appimage
- runner: windows-latest
target: x86_64-pc-windows-msvc
args: --target x86_64-pc-windows-msvc --bundles nsis
- runner: windows-latest # cross-compiled
target: aarch64-pc-windows-msvc
args: --target aarch64-pc-windows-msvc --bundles nsis
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v6
- name: Install Linux system dependencies
if: startsWith(matrix.runner, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libgtk-3-dev \
librsvg2-dev \
libsoup-3.0-dev \
libayatana-appindicator3-dev \
patchelf
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Enable Yarn 4
run: |
corepack enable
corepack prepare "$(node -p "require('./js/package.json').packageManager")" --activate
- name: Install frontend dependencies
working-directory: js
run: yarn install --immutable
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: rust -> target
- uses: cargo-bins/cargo-binstall@main
- run: cargo binstall -y 'tauri-cli@^2'
- name: Set version in tauri.conf.json
env:
VERSION: ${{ needs.prepare.outputs.version }}
run: |
node -e "const fs=require('fs');const p='rust/tauri.conf.json';const j=JSON.parse(fs.readFileSync(p,'utf8'));j.version=process.env.VERSION;fs.writeFileSync(p,JSON.stringify(j,null,2)+'\n')"
- name: Build & upload bundles
uses: tauri-apps/tauri-action@v0.6.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: rust
tauriScript: cargo tauri
releaseId: ${{ needs.prepare.outputs.release_id }}
args: ${{ matrix.args }}
publish:
needs: [ prepare, build ]
runs-on: ubuntu-latest
steps:
- name: Publish release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
RELEASE_ID="${{ needs.prepare.outputs.release_id }}"
if [ -z "$RELEASE_ID" ]; then
echo "Missing release_id from prepare job" >&2
exit 1
fi
gh api -X PATCH \
"repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" \
-F draft=false