Desktop Package #10
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: Desktop Package | |
| on: | |
| # Triggered explicitly by release workflows to avoid duplicate packaging. | |
| workflow_dispatch: | |
| inputs: | |
| tag_name: | |
| description: "Tag name to build (e.g. v0.2.0). Leave empty to build from HEAD." | |
| required: false | |
| type: string | |
| upload_to_release: | |
| description: "Upload built artifacts to the release specified by tag_name." | |
| required: false | |
| default: false | |
| type: boolean | |
| permissions: | |
| contents: write | |
| jobs: | |
| # ── Resolve version info ─────────────────────────────────────────── | |
| prepare: | |
| name: Prepare | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.meta.outputs.version }} | |
| release_tag: ${{ steps.meta.outputs.release_tag }} | |
| upload_to_release: ${{ steps.meta.outputs.upload_to_release }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Resolve version metadata | |
| id: meta | |
| shell: bash | |
| env: | |
| INPUT_TAG_NAME: ${{ inputs.tag_name }} | |
| INPUT_UPLOAD_TO_RELEASE: ${{ inputs.upload_to_release }} | |
| run: | | |
| set -euo pipefail | |
| if [[ -n "${INPUT_TAG_NAME}" ]]; then | |
| TAG="${INPUT_TAG_NAME}" | |
| VERSION="${TAG#v}" | |
| if [[ "${INPUT_UPLOAD_TO_RELEASE}" == "true" ]]; then | |
| UPLOAD="true" | |
| else | |
| UPLOAD="false" | |
| fi | |
| else | |
| VERSION="$(jq -r '.version' package.json)" | |
| TAG="v${VERSION}" | |
| UPLOAD="false" | |
| fi | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "release_tag=$TAG" >> "$GITHUB_OUTPUT" | |
| echo "upload_to_release=$UPLOAD" >> "$GITHUB_OUTPUT" | |
| # ── Build per platform ───────────────────────────────────────────── | |
| package: | |
| name: Package (${{ matrix.platform.name }}) | |
| runs-on: ${{ matrix.platform.os }} | |
| needs: prepare | |
| env: | |
| NODE_OPTIONS: --max-old-space-size=6144 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - os: macos-15 | |
| name: macos-arm64 | |
| target: aarch64-apple-darwin | |
| build_command: pnpm run desktop:build:arm64 | |
| - os: macos-15-intel | |
| name: macos-x64 | |
| target: x86_64-apple-darwin | |
| build_command: pnpm run desktop:build:x86_64 | |
| - os: windows-latest | |
| name: windows-x64 | |
| target: x86_64-pc-windows-msvc | |
| build_command: pnpm run installer:build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.prepare.outputs.release_tag }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Setup Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.platform.target }} | |
| - name: Cache Rust build | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| shared-key: "package-${{ matrix.platform.name }}" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Type-check web UI | |
| run: pnpm run type-check:web | |
| - name: Build desktop app | |
| run: ${{ matrix.platform.build_command }} | |
| - name: Upload bundles | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bitfun-${{ needs.prepare.outputs.release_tag }}-${{ matrix.platform.name }}-bundle | |
| if-no-files-found: error | |
| path: | | |
| target/*/release/bundle | |
| target/release/bundle | |
| src/apps/desktop/target/release/bundle | |
| BitFun-Installer/src-tauri/target/release/bitfun-installer.exe | |
| # ── Upload assets to GitHub Release ──────────────────────────────── | |
| upload-release-assets: | |
| name: Upload Release Assets | |
| needs: [prepare, package] | |
| if: needs.prepare.outputs.upload_to_release == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download bundled artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: bitfun-${{ needs.prepare.outputs.release_tag }}-*-bundle | |
| path: release-assets | |
| merge-multiple: true | |
| - name: List release assets | |
| run: | | |
| echo "Release assets:" | |
| find release-assets -type f | sort | |
| - name: Upload to release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.prepare.outputs.release_tag }} | |
| files: | | |
| release-assets/**/*.dmg | |
| release-assets/**/*bitfun-installer.exe | |
| fail_on_unmatched_files: true |