# Binary Release workflow # # This workflow builds platform-specific binaries and creates a GitHub Release # when a version tag (v*) is pushed. This is the second release channel — # npm publishing is handled separately by version.yml via changesets. # # Release channels: # 1. npm publish — handled by version.yml (changesets/action) # 2. GitHub Release with binaries — handled by this workflow (release.yml) name: Binary Release on: push: tags: - "v*" workflow_dispatch: permissions: contents: write jobs: # ── Build platform-specific binaries ────────────────────────────────── build-binaries: name: Build ${{ matrix.target }} runs-on: ${{ matrix.os }} timeout-minutes: 30 # Job-level env so the signing steps' `if:` can detect whether the # signing certificate secrets are configured (secrets can't be read in `if:` directly). env: APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} WINDOWS_CERTIFICATE_BASE64: ${{ secrets.WINDOWS_CERTIFICATE_BASE64 }} strategy: fail-fast: false matrix: include: - os: ubuntu-latest target: bun-linux-x64 binary: fn-linux-x64 - os: ubuntu-24.04-arm target: bun-linux-arm64 binary: fn-linux-arm64 - os: macos-latest target: bun-darwin-arm64 binary: fn-darwin-arm64 # bun-darwin-x64 (Intel) dropped: macos-13 runners are scarce and # blocked releases by sitting queued for hours. The CLI ships # Apple-Silicon-only for macOS; desktop macOS DMG/ZIP is universal. - os: windows-latest target: bun-windows-x64 binary: fn-windows-x64.exe steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node and install dependencies uses: ./.github/actions/setup-node-pnpm - name: Install Bun uses: oven-sh/setup-bun@v2 - name: Build run: pnpm build - name: Build binary run: pnpm --filter @runfusion/fusion build:exe -- --target ${{ matrix.target }} - name: Verify binary exists shell: bash run: test -f packages/cli/dist/${{ matrix.binary }} - name: Sign macOS binary # Skip when the Apple certificate secret is absent so unsigned binaries # still publish, mirroring the desktop-macos unsigned fallback path. if: ${{ runner.os == 'macOS' && env.APPLE_CERTIFICATE_BASE64 != '' }} env: APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} APPLE_IDENTITY: ${{ secrets.APPLE_IDENTITY }} APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }} run: bash scripts/sign-macos.sh packages/cli/dist/${{ matrix.binary }} packages/cli/dist/runtime - name: Sign Windows binary # Skip when the Windows certificate secret is absent so unsigned binaries # still publish, mirroring the macOS signing fallback. if: ${{ runner.os == 'Windows' && env.WINDOWS_CERTIFICATE_BASE64 != '' }} env: WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} run: pwsh scripts/sign-windows.ps1 packages/cli/dist/${{ matrix.binary }} - name: Generate checksum (Linux) if: runner.os == 'Linux' run: | cd packages/cli/dist sha256sum ${{ matrix.binary }} > ${{ matrix.binary }}.sha256 - name: Generate checksum (macOS) if: runner.os == 'macOS' run: | cd packages/cli/dist shasum -a 256 ${{ matrix.binary }} > ${{ matrix.binary }}.sha256 - name: Generate checksum (Windows) if: runner.os == 'Windows' shell: pwsh run: | cd packages/cli/dist $hash = (Get-FileHash ${{ matrix.binary }} -Algorithm SHA256).Hash.ToLower() "$hash ${{ matrix.binary }}" | Out-File -Encoding ascii ${{ matrix.binary }}.sha256 - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ${{ matrix.binary }} path: | packages/cli/dist/${{ matrix.binary }} packages/cli/dist/${{ matrix.binary }}.sha256 packages/cli/dist/runtime/**/* # ── Build Windows desktop EXE artifacts ────────────────────────────── # Code-signing with WINDOWS_CERTIFICATE_BASE64 / WINDOWS_CERTIFICATE_PASSWORD # is intentionally deferred to FN-5592; ARM64 support is tracked in FN-5594. build-desktop-windows: name: Build Desktop Windows EXE runs-on: windows-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node and install dependencies uses: ./.github/actions/setup-node-pnpm - name: Build run: pnpm build - name: Build desktop package run: pnpm --filter @fusion/desktop build - name: Package Windows desktop EXE # Use `exec electron-builder` rather than the `dist:win` script: pnpm leaks # the `--` separator into script args (electron-builder then stops parsing # at `--` and ignores `--publish never`, auto-publishing to the wrong repo). run: pnpm --filter @fusion/desktop exec electron-builder --win --publish never env: CSC_IDENTITY_AUTO_DISCOVERY: "false" GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Verify desktop EXE artifacts shell: pwsh run: | $exes = Get-ChildItem packages/desktop/dist-electron -Filter "Fusion-*-win-*.exe" if ($exes.Count -eq 0) { Write-Error "No Fusion Windows EXE artifacts produced" exit 1 } - name: Generate desktop EXE checksums shell: pwsh run: | $exes = Get-ChildItem packages/desktop/dist-electron -Filter "Fusion-*-win-*.exe" foreach ($exe in $exes) { $hash = (Get-FileHash $exe.FullName -Algorithm SHA256).Hash.ToLower() "$hash $($exe.Name)" | Out-File -Encoding ascii "$($exe.FullName).sha256" } - name: Upload desktop Windows artifacts uses: actions/upload-artifact@v4 with: name: fusion-desktop-windows path: | packages/desktop/dist-electron/Fusion-*-win-*.exe packages/desktop/dist-electron/Fusion-*-win-*.exe.sha256 packages/desktop/dist-electron/Fusion-*-win-*.exe.blockmap packages/desktop/dist-electron/latest.yml # ── Build macOS desktop artifacts ──────────────────────────────────── build-desktop-macos: name: Build Desktop macOS DMG/ZIP runs-on: macos-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node and install dependencies uses: ./.github/actions/setup-node-pnpm - name: Build run: pnpm build - name: Build desktop package run: pnpm --filter @fusion/desktop build - name: Package signed macOS desktop DMG/ZIP if: ${{ env.APPLE_CERTIFICATE_BASE64 != '' }} run: pnpm --filter @fusion/desktop exec electron-builder --mac --publish never env: APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} CSC_LINK: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} CSC_IDENTITY_AUTO_DISCOVERY: "true" GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Package unsigned macOS desktop DMG/ZIP if: ${{ env.APPLE_CERTIFICATE_BASE64 == '' }} run: pnpm --filter @fusion/desktop exec electron-builder --mac --publish never -c.mac.notarize=false env: APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} CSC_IDENTITY_AUTO_DISCOVERY: "false" GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Verify signed and notarized macOS artifacts if: ${{ env.APPLE_CERTIFICATE_BASE64 != '' }} env: APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }} shell: bash run: | set -euo pipefail shopt -s nullglob dmgs=(packages/desktop/dist-electron/Fusion-*-mac-*.dmg) zips=(packages/desktop/dist-electron/Fusion-*-mac-*.zip) if [ ${#dmgs[@]} -eq 0 ]; then echo "No Fusion macOS DMG artifacts produced" >&2 exit 1 fi if [ ${#zips[@]} -eq 0 ]; then echo "No Fusion macOS ZIP artifacts produced" >&2 exit 1 fi for dmg in "${dmgs[@]}"; do echo "Verifying signed DMG: $dmg" codesign --verify --deep --strict --verbose=2 "$dmg" spctl --assess --type open --context context:primary-signature -v "$dmg" xcrun stapler validate "$dmg" done for zip in "${zips[@]}"; do echo "Verifying ZIP app bundle: $zip" tmpdir="$(mktemp -d)" unzip -q "$zip" -d "$tmpdir" app="$(find "$tmpdir" -type d -name '*.app' -print -quit)" if [ -z "$app" ]; then echo "No .app bundle found in $zip" >&2 rm -rf "$tmpdir" exit 1 fi codesign --verify --deep --strict --verbose=2 "$app" spctl --assess --type exec -v "$app" xcrun stapler validate "$app" rm -rf "$tmpdir" done - name: Generate desktop macOS checksums shell: bash run: | shopt -s nullglob for file in packages/desktop/dist-electron/Fusion-*-mac-*.dmg packages/desktop/dist-electron/Fusion-*-mac-*.zip; do shasum -a 256 "$file" > "$file.sha256" done - name: Upload desktop macOS artifacts uses: actions/upload-artifact@v4 with: name: fusion-desktop-macos path: | packages/desktop/dist-electron/Fusion-*-mac-*.dmg packages/desktop/dist-electron/Fusion-*-mac-*.dmg.sha256 packages/desktop/dist-electron/Fusion-*-mac-*.zip packages/desktop/dist-electron/Fusion-*-mac-*.zip.sha256 packages/desktop/dist-electron/Fusion-*-mac-*.blockmap packages/desktop/dist-electron/latest-mac.yml # ── Build Linux desktop artifacts ──────────────────────────────────── build-desktop-linux: name: Build Desktop Linux Artifacts runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Node and install dependencies uses: ./.github/actions/setup-node-pnpm - name: Build run: pnpm build - name: Build desktop package run: pnpm --filter @fusion/desktop build - name: Package Linux desktop artifacts # Linux desktop code-signing is deferred to FN-5605; Linux ARM64 CLI binaries are tracked in FN-5606. run: pnpm --filter @fusion/desktop exec electron-builder --linux --x64 --arm64 --publish never env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Verify desktop Linux AppImage artifacts shell: bash run: | shopt -s nullglob arm64_appimages=(packages/desktop/dist-electron/Fusion-*-linux-arm64.AppImage) # electron-builder names the x64 AppImage with the x86_64 arch suffix # (deb uses amd64, tar.gz uses x64) — match the actual output name. x64_appimages=(packages/desktop/dist-electron/Fusion-*-linux-x86_64.AppImage) if [ ${#arm64_appimages[@]} -eq 0 ]; then echo "No Fusion Linux arm64 AppImage artifacts produced" >&2 exit 1 fi if [ ${#x64_appimages[@]} -eq 0 ]; then echo "No Fusion Linux x64 AppImage artifacts produced" >&2 exit 1 fi - name: Sign Linux desktop artifacts if: ${{ env.LINUX_GPG_PRIVATE_KEY != '' }} env: LINUX_GPG_PRIVATE_KEY: ${{ secrets.LINUX_GPG_PRIVATE_KEY }} LINUX_GPG_PASSPHRASE: ${{ secrets.LINUX_GPG_PASSPHRASE }} LINUX_GPG_KEY_ID: ${{ secrets.LINUX_GPG_KEY_ID }} shell: bash run: | shopt -s nullglob artifacts=( packages/desktop/dist-electron/Fusion-*-linux-*.AppImage packages/desktop/dist-electron/Fusion-*-linux-*.deb packages/desktop/dist-electron/Fusion-*-linux-*.tar.gz ) bash scripts/sign-linux.sh "${artifacts[@]}" - name: Generate desktop Linux checksums shell: bash run: | shopt -s nullglob for file in packages/desktop/dist-electron/Fusion-*-linux-*.AppImage packages/desktop/dist-electron/Fusion-*-linux-*.deb packages/desktop/dist-electron/Fusion-*-linux-*.tar.gz; do sha256sum "$file" > "$file.sha256" done - name: Upload desktop Linux artifacts uses: actions/upload-artifact@v4 with: # Single glob set covers both linux-x64 and linux-arm64 artifact filenames. name: fusion-desktop-linux if-no-files-found: ignore path: | packages/desktop/dist-electron/Fusion-*-linux-*.AppImage packages/desktop/dist-electron/Fusion-*-linux-*.AppImage.sha256 packages/desktop/dist-electron/Fusion-*-linux-*.AppImage.asc packages/desktop/dist-electron/Fusion-*-linux-*.deb packages/desktop/dist-electron/Fusion-*-linux-*.deb.sha256 packages/desktop/dist-electron/Fusion-*-linux-*.deb.asc packages/desktop/dist-electron/Fusion-*-linux-*.tar.gz packages/desktop/dist-electron/Fusion-*-linux-*.tar.gz.sha256 packages/desktop/dist-electron/Fusion-*-linux-*.tar.gz.asc packages/desktop/dist-electron/latest-linux.yml # ── Create GitHub Release ───────────────────────────────────────────── github-release: name: Create GitHub Release needs: [build-binaries, build-desktop-windows, build-desktop-macos, build-desktop-linux] # Run as long as the workflow wasn't cancelled, even if some build legs failed, # so a single failing matrix leg doesn't suppress publishing the ones that did # build. Gated to tag pushes only: a workflow_dispatch run on a branch is a # build-only validation (artifacts are still uploaded), and would otherwise try # to create a release tagged with the branch name. if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/') }} runs-on: ubuntu-latest permissions: contents: write steps: - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts - name: Collect release files id: collect run: | mkdir release-files find artifacts -type f \( -name "fn-*" -o -name "*.sha256" -o -name "*.asc" -o -name "*.exe" -o -name "*.exe.sha256" -o -name "*.blockmap" -o -name "*.dmg" -o -name "*.dmg.sha256" -o -name "*.zip" -o -name "*.zip.sha256" -o -name "*.AppImage" -o -name "*.AppImage.sha256" -o -name "*.deb" -o -name "*.deb.sha256" -o -name "*.tar.gz" -o -name "*.tar.gz.sha256" -o -name "latest*.yml" \) -exec cp {} release-files/ \; ls -la release-files/ count=$(find release-files -type f | wc -l | tr -d ' ') echo "count=$count" >> "$GITHUB_OUTPUT" if [ "$count" -eq 0 ]; then echo "::error::No release artifacts were produced by any build job; skipping release creation." >&2 fi # Only create the release if at least one artifact exists. A failed build leg # yields a partial release rather than none; a total wipeout fails loudly. - name: Create GitHub Release if: ${{ steps.collect.outputs.count != '0' }} uses: softprops/action-gh-release@v2 with: generate_release_notes: true fail_on_unmatched_files: true files: release-files/*