Release #37
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: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-and-release: | |
| permissions: | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [macos-latest, windows-latest] | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Ensure full history for tag-based versioning | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Cache Bun dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.bun/install/cache | |
| key: ${{ runner.os }}-bun-cache-${{ hashFiles('**/bun.lockb') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun-cache- | |
| - name: Verify Bun installation | |
| run: bun --version # Confirm Bun is installed | |
| - name: Install frontend dependencies | |
| run: bun install --frozen-lockfile | |
| env: | |
| BUN_CONFIG_LOGLEVEL: warn # Reduce logging noise | |
| - name: Rust setup | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| - name: Rust cache | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: './app-tauri -> target' | |
| cache-all-crates: true # Cache all dependencies for faster Windows builds | |
| - name: Generate prisma client | |
| working-directory: crates/db | |
| run: cargo prisma generate | |
| env: | |
| CARGO_BUILD_JOBS: 4 # Parallel compilation for faster builds | |
| - name: Build the app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
| TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | |
| CARGO_BUILD_JOBS: 4 # Parallel compilation for Windows | |
| CARGO_NET_OFFLINE: true # Use locked dependencies | |
| with: | |
| tagName: ${{ github.ref_name }} | |
| releaseName: 'Hero v__VERSION__' | |
| releaseBody: 'See the assets to download and install this version.' | |
| releaseDraft: false | |
| prerelease: false | |
| args: ${{ matrix.platform == 'windows-latest' && '--target x86_64-pc-windows-msvc' || '' }} # Optimize Windows target | |
| - name: Create GitHub Release | |
| if: matrix.platform == 'macos-latest' # Run only once to avoid duplicate releases | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: 'Hero v${{ github.ref_name }}' | |
| body: 'Automated release for Hero. See assets below for downloads.' | |
| draft: false | |
| prerelease: false | |
| files: | | |
| dist/*.dmg | |
| dist/*.msi | |
| dist/*.exe | |
| coverage: | |
| runs-on: ubuntu-latest | |
| needs: build-and-release # Run coverage only after successful builds | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v4 | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |