update #24
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: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| build: | |
| permissions: | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: macos-latest | |
| args: "--target universal-apple-darwin" | |
| rust-targets: "aarch64-apple-darwin,x86_64-apple-darwin" | |
| - platform: windows-latest | |
| args: "" | |
| rust-targets: "" | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Disable symlinks (Windows) | |
| if: runner.os == 'Windows' | |
| run: git config --system core.symlinks false | |
| - uses: actions/checkout@v5 | |
| - name: Read version | |
| id: pkg | |
| shell: bash | |
| run: echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT" | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v5 | |
| with: | |
| node-version: 24 | |
| - name: Get pnpm store path | |
| id: pnpm-store | |
| shell: bash | |
| run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT" | |
| - name: Cache pnpm store | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-store.outputs.path }} | |
| key: pnpm-${{ matrix.platform }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: pnpm-${{ matrix.platform }}- | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.rust-targets }} | |
| - name: Cache Rust build | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index | |
| ~/.cargo/registry/cache | |
| ~/.cargo/git/db | |
| src-tauri/target | |
| key: rust-${{ matrix.platform }}-${{ hashFiles('src-tauri/Cargo.lock') }} | |
| restore-keys: rust-${{ matrix.platform }}- | |
| - name: Install frontend deps | |
| run: pnpm install --frozen-lockfile | |
| - name: Install macOS DMG dependencies | |
| if: runner.os == 'macOS' | |
| run: brew install create-dmg | |
| - 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: | |
| tagName: v${{ steps.pkg.outputs.version }} | |
| releaseName: "MaxAuto v${{ steps.pkg.outputs.version }}" | |
| releaseBody: "Desktop installer for MaxAuto v${{ steps.pkg.outputs.version }}" | |
| releaseDraft: false | |
| prerelease: false | |
| args: ${{ matrix.args }} --verbose | |
| bump-version: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Bump patch version | |
| run: | | |
| CURRENT=$(node -p "require('./package.json').version") | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" | |
| NEXT="${MAJOR}.${MINOR}.$((PATCH + 1))" | |
| echo "Bumping version: ${CURRENT} -> ${NEXT}" | |
| node -e " | |
| const fs = require('fs'); | |
| const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); | |
| pkg.version = '${NEXT}'; | |
| fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n'); | |
| " | |
| node -e " | |
| const fs = require('fs'); | |
| const conf = JSON.parse(fs.readFileSync('src-tauri/tauri.conf.json', 'utf8')); | |
| conf.version = '${NEXT}'; | |
| fs.writeFileSync('src-tauri/tauri.conf.json', JSON.stringify(conf, null, 2) + '\n'); | |
| " | |
| - name: Commit version bump | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add package.json src-tauri/tauri.conf.json | |
| git commit -m "chore: bump version to $(node -p "require('./package.json').version")" | |
| git pull --rebase | |
| git push |