Skip to content

update readme

update readme #8

Workflow file for this run

name: Build and Release
on:
push:
branches:
- main
workflow_dispatch:
inputs:
platform:
description: "Platform to build"
required: true
default: "all"
type: choice
options:
- all
- linux
- windows
- macos-intel
- macos-arm64
release:
description: "Create a release after build"
required: false
default: false
type: boolean
env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: short
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: linux
os: ubuntu-22.04
rust_target: x86_64-unknown-linux-gnu
tauri_target: x86_64-unknown-linux-gnu
bun_target: bun-linux-x64
name: linux-x86_64
- platform: windows
os: windows-latest
rust_target: x86_64-pc-windows-msvc
tauri_target: x86_64-pc-windows-msvc
bun_target: bun-windows-x64
name: windows-x86_64
- platform: macos-intel
os: macos-latest
rust_target: x86_64-apple-darwin
tauri_target: x86_64-apple-darwin
bun_target: bun-darwin-x64
name: macos-intel
- platform: macos-arm64
os: macos-latest
rust_target: aarch64-apple-darwin
tauri_target: aarch64-apple-darwin
bun_target: bun-darwin-arm64
name: macos-arm64
runs-on: ${{ matrix.os }}
steps:
- name: Check platform filter
id: check
shell: bash
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.platform }}" != "all" && "${{ github.event.inputs.platform }}" != "${{ matrix.platform }}" ]]; then
echo "skip=true" >> $GITHUB_OUTPUT
echo "Skipping ${{ matrix.platform }} (selected: ${{ github.event.inputs.platform }})"
else
echo "skip=false" >> $GITHUB_OUTPUT
echo "Building ${{ matrix.platform }}"
fi
- name: Checkout repository
if: steps.check.outputs.skip != 'true'
uses: actions/checkout@v4
- name: Install dependencies (Linux)
if: steps.check.outputs.skip != 'true' && matrix.platform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libfuse2 file
# Fix for linuxdeploy in GitHub Actions (FUSE not available)
echo "APPIMAGE_EXTRACT_AND_RUN=1" >> $GITHUB_ENV
- name: Setup Node.js
if: steps.check.outputs.skip != 'true'
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Setup pnpm
if: steps.check.outputs.skip != 'true'
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Bun
if: steps.check.outputs.skip != 'true'
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Get pnpm store directory
if: steps.check.outputs.skip != 'true'
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
if: steps.check.outputs.skip != 'true'
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: Setup Rust
if: steps.check.outputs.skip != 'true'
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Setup Rust cache
if: steps.check.outputs.skip != 'true'
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"
shared-key: ${{ matrix.name }}
- name: Install frontend dependencies
if: steps.check.outputs.skip != 'true'
run: pnpm install
- name: Build API sidecar (Unix)
if: steps.check.outputs.skip != 'true' && matrix.platform != 'windows'
shell: bash
run: |
cd src-api
mkdir -p dist
bun build src/index.ts --compile --target=${{ matrix.bun_target }} --outfile dist/workany-api-${{ matrix.rust_target }}
- name: Build API sidecar (Windows)
if: steps.check.outputs.skip != 'true' && matrix.platform == 'windows'
shell: bash
run: |
cd src-api
mkdir -p dist
bun build src/index.ts --compile --target=${{ matrix.bun_target }} --outfile dist/workany-api-${{ matrix.rust_target }}.exe
- name: Build Tauri app (Linux - skip AppImage)
if: steps.check.outputs.skip != 'true' && matrix.platform == 'linux'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: --target ${{ matrix.tauri_target }} --bundles deb,rpm
- name: Build Tauri app (Windows/macOS)
if: steps.check.outputs.skip != 'true' && matrix.platform != 'linux'
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# macOS signing and notarization
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
args: --target ${{ matrix.tauri_target }}
- name: Upload artifacts (Linux)
if: steps.check.outputs.skip != 'true' && matrix.platform == 'linux'
uses: actions/upload-artifact@v4
with:
name: WorkAny-${{ matrix.name }}
path: |
src-tauri/target/${{ matrix.tauri_target }}/release/bundle/deb/*.deb
src-tauri/target/${{ matrix.tauri_target }}/release/bundle/rpm/*.rpm
if-no-files-found: ignore
- name: Upload artifacts (Windows)
if: steps.check.outputs.skip != 'true' && matrix.platform == 'windows'
uses: actions/upload-artifact@v4
with:
name: WorkAny-${{ matrix.name }}
path: |
src-tauri/target/${{ matrix.tauri_target }}/release/bundle/msi/*.msi
src-tauri/target/${{ matrix.tauri_target }}/release/bundle/nsis/*.exe
if-no-files-found: ignore
- name: Upload artifacts (macOS)
if: steps.check.outputs.skip != 'true' && startsWith(matrix.platform, 'macos')
uses: actions/upload-artifact@v4
with:
name: WorkAny-${{ matrix.name }}
path: |
src-tauri/target/${{ matrix.tauri_target }}/release/bundle/dmg/*.dmg
src-tauri/target/${{ matrix.tauri_target }}/release/bundle/macos/*.app
if-no-files-found: ignore
release:
needs: build
runs-on: ubuntu-latest
# Auto release on: push to main or manual trigger with release=true
if: github.ref == 'refs/heads/main' || github.event.inputs.release == 'true'
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure of downloaded files
run: |
ls -R artifacts
echo "---"
find artifacts -type f -name "*.deb" -o -name "*.rpm" -o -name "*.msi" -o -name "*.exe" -o -name "*.dmg" | head -20
- name: Flatten artifacts for release
run: |
mkdir -p release-files
find artifacts -type f \( -name "*.deb" -o -name "*.rpm" -o -name "*.msi" -o -name "*.exe" -o -name "*.dmg" \) -exec cp {} release-files/ \;
ls -la release-files/
- name: Checkout for version
uses: actions/checkout@v4
- name: Get version from package.json
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
tag_name: v${{ steps.version.outputs.version }}
name: WorkAny v${{ steps.version.outputs.version }}
files: release-files/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}