name: Release binaries # Build per-platform binaries and attach them to the GitHub Release for the # pushed tag. No npm, no tokens — only the built-in GITHUB_TOKEN. Consumers # install with: curl -fsSL .../install.sh | sh on: push: tags: - 'v*' workflow_dispatch: inputs: tag: description: 'Existing tag to (re)build binaries for, e.g. v0.27.0-fork.12' required: true permissions: contents: write concurrency: release-binaries-${{ github.ref }} jobs: build: name: Build ${{ matrix.name }} runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: fail-fast: false matrix: include: - { name: Linux x64, os: ubuntu-latest, target: x86_64-unknown-linux-gnu, asset: chrome-use-linux-x64, use_zigbuild: true, ext: '' } - { name: Linux ARM64, os: ubuntu-latest, target: aarch64-unknown-linux-gnu, asset: chrome-use-linux-arm64, use_zigbuild: true, ext: '' } - { name: Linux musl x64, os: ubuntu-latest, target: x86_64-unknown-linux-musl, asset: chrome-use-linux-musl-x64, use_zigbuild: true, ext: '' } - { name: Linux musl ARM64, os: ubuntu-latest, target: aarch64-unknown-linux-musl, asset: chrome-use-linux-musl-arm64, use_zigbuild: true, ext: '' } - { name: Windows x64, os: ubuntu-latest, target: x86_64-pc-windows-gnu, asset: chrome-use-win32-x64, use_zigbuild: false, ext: '.exe' } - { name: macOS x64, os: macos-latest, target: x86_64-apple-darwin, asset: chrome-use-darwin-x64, use_zigbuild: false, ext: '' } - { name: macOS ARM64, os: macos-latest, target: aarch64-apple-darwin, asset: chrome-use-darwin-arm64, use_zigbuild: false, ext: '' } steps: - name: Checkout uses: actions/checkout@v6 with: ref: ${{ github.event.inputs.tag || github.ref }} - name: Setup Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Install cross-compilation tools (Linux) if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu mingw-w64 - name: Install cargo-zigbuild if: matrix.use_zigbuild run: | pip3 install ziglang cargo install cargo-zigbuild - name: Configure Rust linkers if: runner.os == 'Linux' run: | mkdir -p ~/.cargo cat >> ~/.cargo/config.toml << 'EOF' [target.aarch64-unknown-linux-gnu] linker = "aarch64-linux-gnu-gcc" [target.x86_64-pc-windows-gnu] linker = "x86_64-w64-mingw32-gcc" EOF - name: Cache Rust build artifacts uses: Swatinem/rust-cache@v2 with: workspaces: cli - name: Build (zigbuild) if: matrix.use_zigbuild run: cargo zigbuild --release --manifest-path cli/Cargo.toml --target ${{ matrix.target }} - name: Build (cargo) if: '!matrix.use_zigbuild' run: cargo build --release --manifest-path cli/Cargo.toml --target ${{ matrix.target }} - name: Package (.tar.gz + .sha256) shell: bash run: | set -euo pipefail mkdir -p dist src="cli/target/${{ matrix.target }}/release/chrome-use${{ matrix.ext }}" # The binary inside every archive is named `chrome-use` (or .exe); # install.sh extracts that fixed name regardless of platform. cp "$src" "dist/chrome-use${{ matrix.ext }}" chmod +x "dist/chrome-use${{ matrix.ext }}" || true ( cd dist tar czf "${{ matrix.asset }}.tar.gz" "chrome-use${{ matrix.ext }}" if command -v sha256sum >/dev/null 2>&1; then sha256sum "${{ matrix.asset }}.tar.gz" > "${{ matrix.asset }}.tar.gz.sha256" else shasum -a 256 "${{ matrix.asset }}.tar.gz" > "${{ matrix.asset }}.tar.gz.sha256" fi ) - name: Upload artifact uses: actions/upload-artifact@v7 with: name: ${{ matrix.asset }} path: dist/${{ matrix.asset }}.tar.gz* retention-days: 3 release: name: Attach binaries to GitHub Release needs: build runs-on: ubuntu-latest timeout-minutes: 10 permissions: contents: write steps: - name: Download all artifacts uses: actions/download-artifact@v8 with: path: dist merge-multiple: true - name: List assets run: ls -la dist - name: Attach to release uses: softprops/action-gh-release@v3 with: tag_name: ${{ github.event.inputs.tag || github.ref_name }} files: | dist/*.tar.gz dist/*.tar.gz.sha256 fail_on_unmatched_files: true # keep existing release notes if the release was created beforehand append_body: false