Pack Electron App #321
Workflow file for this run
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: Pack Electron App | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| tags: | |
| - "v*" | |
| merge_group: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: macos-latest | |
| platform: macos-arm64 | |
| - os: windows-latest | |
| platform: windows | |
| - os: ubuntu-latest | |
| platform: linux-x64 | |
| - os: ubuntu-24.04-arm | |
| platform: linux-arm64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # Linux: install tooling needed by electron-builder for deb/rpm targets | |
| - name: Install Linux packaging tools | |
| if: runner.os == 'Linux' | |
| run: sudo apt-get update && sudo apt-get install -y rpm | |
| # Python core | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "latest" | |
| - name: Set up Python | |
| run: uv python install 3.13 | |
| # Only runtime + build deps: dev-group packages must never influence what | |
| # PyInstaller bundles (see logging.config regression in v4.3.0). | |
| - name: Install Python dependencies | |
| run: uv sync --group build | |
| - name: Build Python core (PyInstaller) | |
| run: uv run pyinstaller --clean --noconfirm tuttle-rpc.spec | |
| # Verify the frozen binary actually bundles every RPC domain before the | |
| # expensive Electron packaging step (fail-fast on packaging regressions). | |
| - name: Smoke-test core (every domain bundled) | |
| run: uv run python scripts/smoke_core.py | |
| # Electron app | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "22" | |
| - name: Install Electron dependencies | |
| run: npm ci | |
| working-directory: ui | |
| - name: Build Electron app | |
| run: npm run build | |
| working-directory: ui | |
| - name: Package Electron app (signed) | |
| if: startsWith(github.ref, 'refs/tags/') && runner.os == 'macOS' | |
| run: npx electron-builder --publish never | |
| working-directory: ui | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CSC_LINK: ${{ secrets.CSC_LINK }} | |
| CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
| APPLE_ID: ${{ secrets.APPLE_ID }} | |
| APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
| APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
| - name: Package Electron app (unsigned) | |
| if: "!(startsWith(github.ref, 'refs/tags/') && runner.os == 'macOS')" | |
| run: npx electron-builder --publish never | |
| working-directory: ui | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CSC_IDENTITY_AUTO_DISCOVERY: "false" | |
| - uses: actions/upload-artifact@v7 | |
| if: github.event_name != 'merge_group' | |
| with: | |
| name: Tuttle-${{ github.ref_name }}-${{ matrix.platform }} | |
| path: ui/release/ | |
| # Upload artifacts to GitHub Release only after ALL platforms succeed | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: artifacts/ | |
| - name: Upload release assets | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| tag="${GITHUB_REF#refs/tags/}" | |
| for f in artifacts/**/*.{dmg,zip,exe,deb,rpm,AppImage,yml,blockmap}; do | |
| [ -f "$f" ] || continue | |
| echo "Uploading: $f" | |
| gh release upload "$tag" "$f" --repo "$GITHUB_REPOSITORY" --clobber | |
| done |