Skip to content

Release Desktop App

Release Desktop App #3

name: "Release Desktop App"
on:
push:
tags:
- "desktop-v*"
workflow_dispatch:
inputs:
version_bump:
description: 'Version Bump Type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
prepare:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
should_release: ${{ steps.vars.outputs.should_release }}
new_sha: ${{ steps.bump.outputs.new_sha }}
release_id: ${{ steps.create_release.outputs.id }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Setup Node.js
if: github.event_name == 'workflow_dispatch'
uses: actions/setup-node@v5
with:
node-version: "22"
- name: Bump Version & Tag
if: github.event_name == 'workflow_dispatch'
id: bump
run: |
cd apps/desktop
npm version ${{ github.event.inputs.version_bump }} --no-git-tag-version
NEW_VERSION=$(node -p "require('./package.json').version")
cd src-tauri
jq --arg v "$NEW_VERSION" '.version = $v' tauri.conf.json > tmp.json && mv tmp.json tauri.conf.json
cd ../../..
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add apps/desktop/package.json apps/desktop/src-tauri/tauri.conf.json
git commit -m "chore(desktop): bump version to $NEW_VERSION"
git tag "desktop-v$NEW_VERSION"
git push origin HEAD --tags
echo "new_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "tag_name=desktop-v$NEW_VERSION" >> $GITHUB_OUTPUT
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
- name: Set Variables
id: vars
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "tag_name=${{ steps.bump.outputs.tag_name }}" >> $GITHUB_OUTPUT
echo "version=${{ steps.bump.outputs.version }}" >> $GITHUB_OUTPUT
else
echo "tag_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
VERSION=$(echo "${{ github.ref_name }}" | sed 's/desktop-v//')
echo "version=$VERSION" >> $GITHUB_OUTPUT
fi
echo "should_release=true" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.vars.outputs.tag_name }}
name: "Basetrack Desktop Companion v${{ steps.vars.outputs.version }}"
body: |
## Basetrack Desktop v${{ steps.vars.outputs.version }}
This is the latest release for Basetrack Desktop Companion.
Please download the appropriate installer for your operating system from the assets below.
### Supported Platforms
- **Windows**: `.msi`, `.exe`
- **macOS**: `.dmg`, `.app.tar.gz` (Intel & Apple Silicon)
- **Linux**: `.deb`, `.rpm`, `.AppImage`
draft: true
prerelease: false
release:
needs: prepare
if: needs.prepare.outputs.should_release == 'true'
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-14"
args: "--target aarch64-apple-darwin"
target: "aarch64-apple-darwin"
- platform: "macos-14"
args: "--target x86_64-apple-darwin"
target: "x86_64-apple-darwin"
- platform: "ubuntu-22.04"
args: ""
target: "x86_64-unknown-linux-gnu"
- platform: "windows-latest"
args: ""
target: "x86_64-pc-windows-msvc"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v5
with:
ref: ${{ github.event_name == 'workflow_dispatch' && needs.prepare.outputs.new_sha || github.ref }}
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: "./apps/desktop/src-tauri -> target"
- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Build Tauri App and Upload Assets
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: "./apps/desktop"
releaseId: ${{ needs.prepare.outputs.release_id }}
includeUpdaterJson: false
args: ${{ matrix.args }}