Skip to content

Release

Release #2

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g., v1.0.0)'
required: true
type: string
jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
release_id: ${{ steps.create-release.outputs.id }}
upload_url: ${{ steps.create-release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- name: Create Release
id: create-release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.tag || github.ref_name }}
draft: true
generate_release_notes: true
build-tauri:
needs: create-release
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: windows-latest
args: ''
- platform: macos-latest
args: '--target aarch64-apple-darwin'
- platform: macos-latest
args: '--target x86_64-apple-darwin'
- platform: ubuntu-22.04
args: ''
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- 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: './apps/desktop/src-tauri -> target'
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: pnpm install --frozen-lockfile
- name: Update version and pubkey from tag
shell: bash
env:
INPUT_TAG: ${{ inputs.tag }}
run: |
# Get tag from input or ref
if [[ -n "$INPUT_TAG" ]]; then
TAG_NAME="$INPUT_TAG"
else
TAG_NAME="$GITHUB_REF_NAME"
fi
VERSION="${TAG_NAME#v}"
echo "Updating version to $VERSION"
cd apps/desktop/src-tauri
# Update version
if [[ "$RUNNER_OS" == "Windows" ]]; then
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" tauri.conf.json
else
sed -i '' "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" tauri.conf.json || \
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" tauri.conf.json
fi
# Update pubkey if provided
if [[ -n "${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}" ]]; then
if [[ "$RUNNER_OS" == "Windows" ]]; then
sed -i "s/\"pubkey\": \"[^\"]*\"/\"pubkey\": \"${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}\"/" tauri.conf.json
else
sed -i '' "s/\"pubkey\": \"[^\"]*\"/\"pubkey\": \"${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}\"/" tauri.conf.json || \
sed -i "s/\"pubkey\": \"[^\"]*\"/\"pubkey\": \"${{ secrets.TAURI_SIGNING_PUBLIC_KEY }}\"/" tauri.conf.json
fi
fi
cat tauri.conf.json | grep -E "version|pubkey"
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
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:
releaseId: ${{ needs.create-release.outputs.release_id }}
projectPath: './apps/desktop'
tauriScript: 'pnpm tauri'
args: ${{ matrix.args }}
includeUpdaterJson: true
publish-release:
needs: [create-release, build-tauri]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Publish release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ needs.create-release.outputs.release_id }}