name: Build native binaries # On every new release (tag push of `v*`), this workflow: # 1. builds the gelectron native engine + N-API addons for all platforms, # 2. packages portable archives, and # 3. builds installers you can simply install: # - macOS: Gelectron--arm64.dmg / Gelectron--x64.dmg # - Windows: Gelectron--x64.exe / Gelectron--arm64.exe # - Linux: Gelectron--x86_64.AppImage / Gelectron--aarch64.AppImage # # Everything is attached to the GitHub Release for that tag. on: push: tags: - 'v*' workflow_dispatch: jobs: # ── N-API addons (published to npm, also attached to the release) ───────── addon: name: Addon ${{ matrix.target }} strategy: fail-fast: false matrix: include: - os: macos-14 target: aarch64-apple-darwin - os: macos-13 target: x86_64-apple-darwin - os: windows-latest target: x86_64-pc-windows-msvc - os: windows-latest target: aarch64-pc-windows-msvc - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu - os: ubuntu-24.04-arm target: aarch64-unknown-linux-gnu runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Rust uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Setup Node uses: actions/setup-node@v4 with: node-version: 20 registry-url: 'https://registry.npmjs.org' - name: Install dependencies run: npm ci - name: Build N-API addon for ${{ matrix.target }} run: npx napi build --platform --release --target ${{ matrix.target }} --package gelectron-core - name: Rename .node file with platform-specific name shell: bash run: | case "${{ matrix.target }}" in x86_64-apple-darwin) name="gelectron_core.darwin-x64.node" ;; aarch64-apple-darwin) name="gelectron_core.darwin-arm64.node" ;; x86_64-pc-windows-msvc) name="gelectron_core.win32-x64-msvc.node" ;; aarch64-pc-windows-msvc) name="gelectron_core.win32-arm64-msvc.node" ;; x86_64-unknown-linux-gnu) name="gelectron_core.linux-x64-gnu.node" ;; aarch64-unknown-linux-gnu) name="gelectron_core.linux-arm64-gnu.node" ;; esac find crates/gelectron-core -name "*.node" -exec mv {} "$name" \; ls -la *.node - name: Upload .node artifact uses: actions/upload-artifact@v4 with: name: bindings-${{ matrix.target }} path: gelectron_core.*.node # ── Native engine + portable archives + installers ──────────────────────── runtime: name: Runtime ${{ matrix.platform }}-${{ matrix.arch }} strategy: fail-fast: false matrix: include: - os: macos-14 target: aarch64-apple-darwin platform: darwin arch: arm64 - os: macos-13 target: x86_64-apple-darwin platform: darwin arch: x64 - os: windows-latest target: x86_64-pc-windows-msvc platform: win32 arch: x64 - os: windows-latest target: aarch64-pc-windows-msvc platform: win32 arch: arm64 - os: ubuntu-22.04 target: x86_64-unknown-linux-gnu platform: linux arch: x64 - os: ubuntu-24.04-arm target: aarch64-unknown-linux-gnu platform: linux arch: arm64 runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Rust uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Setup Node uses: actions/setup-node@v4 with: node-version: 20 - name: Install Linux system dependencies if: matrix.platform == 'linux' run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libsoup-3.0-dev - name: Build gelectron binary run: cargo build --release -p gelectron --target ${{ matrix.target }} - name: Package portable release archive run: | bash scripts/make-release.sh \ -v "${{ github.ref_name }}" \ -p ${{ matrix.platform }} \ -a ${{ matrix.arch }} \ -b "target/${{ matrix.target }}/release/gelectron" \ --no-build # ── macOS DMG installer ──────────────────────────────────────────────── - name: Build macOS installer (DMG) if: matrix.platform == 'darwin' run: bash scripts/pkg/make-dmg.sh -v "${{ github.ref_name }}" -a ${{ matrix.arch }} -b "target/${{ matrix.target }}/release/gelectron" -o dist # ── Windows EXE installer (NSIS) ────────────────────────────────────── - name: Build Windows installer (EXE) if: matrix.platform == 'win32' shell: pwsh run: | choco install nsis -y --no-progress powershell -ExecutionPolicy Bypass -File scripts/pkg/make-exe.ps1 ` -Bin "target/${{ matrix.target }}/release/gelectron.exe" ` -Compat src/electron ` -Version "${{ github.ref_name }}" ` -Arch ${{ matrix.arch }} ` -Out dist # ── Linux AppImage installer ────────────────────────────────────────── - name: Build Linux installer (AppImage) if: matrix.platform == 'linux' run: bash scripts/pkg/make-appimage.sh -v "${{ github.ref_name }}" -b "target/${{ matrix.target }}/release/gelectron" -o dist -a ${{ matrix.arch }} - name: List build outputs run: ls -la dist/ - name: Upload runtime and installer artifacts uses: actions/upload-artifact@v4 with: name: installers-${{ matrix.platform }}-${{ matrix.arch }} path: | dist/gelectron-* dist/Gelectron-* if-no-files-found: error # ── Attach everything to the GitHub Release ─────────────────────────────── release: name: Attach binaries to GitHub Release needs: [addon, runtime] if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest permissions: contents: write steps: - name: Download all binaries uses: actions/download-artifact@v4 with: path: artifacts pattern: bindings-* merge-multiple: true - name: Download all installers uses: actions/download-artifact@v4 with: path: artifacts pattern: installers-* merge-multiple: true - name: List artifacts run: ls -la artifacts/ - name: Upload assets to GitHub Release uses: softprops/action-gh-release@v2 with: files: artifacts/**