|
| 1 | +name: Desktop Package |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + tags: |
| 7 | + - "v*" |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + package: |
| 14 | + name: Package (${{ matrix.platform.name }}) |
| 15 | + runs-on: ${{ matrix.platform.os }} |
| 16 | + |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + platform: |
| 21 | + - os: macos-15-intel |
| 22 | + name: macos-x64 |
| 23 | + target: x86_64-apple-darwin |
| 24 | + build_command: pnpm desktop:build:x86_64 |
| 25 | + - os: macos-15 |
| 26 | + name: macos-arm64 |
| 27 | + target: aarch64-apple-darwin |
| 28 | + build_command: pnpm build:web && cd src/apps/desktop && pnpm tauri build --target aarch64-apple-darwin --bundles dmg |
| 29 | + - os: windows-latest |
| 30 | + name: windows-x64 |
| 31 | + target: x86_64-pc-windows-msvc |
| 32 | + build_command: pnpm desktop:build:nsis |
| 33 | + |
| 34 | + steps: |
| 35 | + - name: Checkout |
| 36 | + uses: actions/checkout@v4 |
| 37 | + |
| 38 | + - name: Setup pnpm |
| 39 | + uses: pnpm/action-setup@v4 |
| 40 | + |
| 41 | + - name: Setup Node.js |
| 42 | + uses: actions/setup-node@v4 |
| 43 | + with: |
| 44 | + node-version: 20 |
| 45 | + cache: pnpm |
| 46 | + |
| 47 | + - name: Setup Rust toolchain |
| 48 | + uses: dtolnay/rust-toolchain@stable |
| 49 | + with: |
| 50 | + targets: ${{ matrix.platform.target }} |
| 51 | + |
| 52 | + - name: Cache Rust build |
| 53 | + uses: swatinem/rust-cache@v2 |
| 54 | + with: |
| 55 | + workspaces: | |
| 56 | + . -> target |
| 57 | +
|
| 58 | + - name: Install dependencies |
| 59 | + run: pnpm install --frozen-lockfile |
| 60 | + |
| 61 | + - name: Build desktop app |
| 62 | + run: ${{ matrix.platform.build_command }} |
| 63 | + |
| 64 | + - name: Upload bundles |
| 65 | + uses: actions/upload-artifact@v4 |
| 66 | + with: |
| 67 | + name: bitfun-${{ matrix.platform.name }}-bundle |
| 68 | + if-no-files-found: error |
| 69 | + path: | |
| 70 | + target/*/release/bundle |
| 71 | + target/release/bundle |
| 72 | + src/apps/desktop/target/release/bundle |
| 73 | +
|
| 74 | + release: |
| 75 | + name: Create GitHub Release |
| 76 | + if: startsWith(github.ref, 'refs/tags/v') |
| 77 | + needs: package |
| 78 | + runs-on: ubuntu-latest |
| 79 | + |
| 80 | + steps: |
| 81 | + - name: Download bundled artifacts |
| 82 | + uses: actions/download-artifact@v4 |
| 83 | + with: |
| 84 | + pattern: bitfun-*-bundle |
| 85 | + path: release-assets |
| 86 | + merge-multiple: true |
| 87 | + |
| 88 | + - name: List release assets |
| 89 | + run: | |
| 90 | + echo "Release assets:" |
| 91 | + find release-assets -type f | sort |
| 92 | +
|
| 93 | + - name: Publish release |
| 94 | + uses: softprops/action-gh-release@v2 |
| 95 | + with: |
| 96 | + tag_name: ${{ github.ref_name }} |
| 97 | + name: ${{ github.ref_name }} |
| 98 | + generate_release_notes: true |
| 99 | + files: | |
| 100 | + release-assets/**/*.dmg |
| 101 | + release-assets/**/*setup.exe |
| 102 | + overwrite_files: true |
| 103 | + fail_on_unmatched_files: true |
0 commit comments