Release Desktop App #2
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 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 | |
| outputs: | |
| should_release: ${{ steps.check.outputs.should_release }} | |
| new_sha: ${{ steps.bump.outputs.new_sha }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/setup-node@v4 | |
| 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 | |
| - name: Check Status | |
| id: check | |
| run: | | |
| echo "should_release=true" >> $GITHUB_OUTPUT | |
| release: | |
| needs: prepare | |
| if: needs.prepare.outputs.should_release == 'true' | |
| permissions: | |
| contents: write | |
| 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: "x86_64-unknown-linux-gnu" | |
| - platform: "windows-latest" | |
| args: "" | |
| target: "x86_64-pc-windows-msvc" | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event_name == 'workflow_dispatch' && needs.prepare.outputs.new_sha || github.ref }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| 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: 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 Create Release | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| projectPath: "./apps/desktop" | |
| tagName: desktop-v__VERSION__ | |
| releaseName: "Basetrack Desktop v__VERSION__" | |
| releaseBody: "See the assets to download this version and install." | |
| releaseDraft: true | |
| prerelease: false | |
| includeUpdaterJson: false | |
| args: ${{ matrix.args }} |