ci(release): add multi-platform Tauri build and auto-release workflow #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version tag (e.g. v0.1.0)' | |
| required: true | |
| default: 'v0.1.0' | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| create-release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| release_id: ${{ steps.create-release.outputs.id }} | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Resolve version | |
| id: version | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| else | |
| VERSION="${GITHUB_REF#refs/tags/}" | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Create GitHub Release | |
| id: create-release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| RELEASE_ID=$(gh release create "$VERSION" \ | |
| --repo "${{ github.repository }}" \ | |
| --title "$VERSION" \ | |
| --generate-notes \ | |
| --draft \ | |
| --json id --jq '.id') | |
| echo "id=$RELEASE_ID" >> "$GITHUB_OUTPUT" | |
| build: | |
| needs: create-release | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: macos-latest | |
| args: '--target aarch64-apple-darwin' | |
| target: aarch64-apple-darwin | |
| - platform: macos-latest | |
| args: '--target x86_64-apple-darwin' | |
| target: x86_64-apple-darwin | |
| - platform: ubuntu-22.04 | |
| args: '' | |
| target: '' | |
| - platform: windows-latest | |
| args: '' | |
| target: '' | |
| runs-on: ${{ matrix.platform }} | |
| name: Build (${{ matrix.platform }}${{ matrix.target && format(' / {0}', matrix.target) || '' }}) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: src-tauri | |
| - name: Install system dependencies (Linux) | |
| 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 \ | |
| libssl-dev \ | |
| pkg-config | |
| - name: Install frontend dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build Tauri app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tagName: ${{ needs.create-release.outputs.version }} | |
| releaseName: ${{ needs.create-release.outputs.version }} | |
| releaseBody: 'See assets below for download.' | |
| releaseDraft: true | |
| prerelease: false | |
| args: ${{ matrix.args }} | |
| publish-release: | |
| name: Publish Release | |
| needs: [create-release, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Publish release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release edit "${{ needs.create-release.outputs.version }}" \ | |
| --repo "${{ github.repository }}" \ | |
| --draft=false |