name: release-engine # Builds the engine binary for every supported target and publishes them, with # sha256 sidecars, as the GitHub Release `engine-v` on this repo. That # release is what the launcher (skill/scripts/impeccable), the npm shim # (cli/bin/cli.js), `impeccable install`, and `bun run fetch:engine` download. # # Trigger: `bun run release:engine` (scripts/release.mjs) verifies # ENGINE_VERSION, the npm platform-package pins, and a clean tree, then # pushes the tag. Third-party actions are pinned to commit SHAs so a # moved tag cannot swap the code this workflow runs. on: push: tags: ['engine-v*'] permissions: contents: write jobs: build: strategy: fail-fast: false matrix: include: - { os: macos-14, target: aarch64-apple-darwin, short: darwin-arm64 } # No Intel runner: GitHub retired macos-13. Apple's toolchain builds # x86_64 on an arm64 host natively once the target is installed. - { os: macos-14, target: x86_64-apple-darwin, short: darwin-x64 } - { os: ubuntu-latest, target: x86_64-unknown-linux-musl, short: linux-x64 } - { os: ubuntu-latest, target: aarch64-unknown-linux-musl, short: linux-arm64, cross: true } - { os: windows-latest, target: x86_64-pc-windows-msvc, short: windows-x64 } runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Check the tag matches ENGINE_VERSION shell: bash run: | set -e want="engine-v$(tr -d '[:space:]' < ENGINE_VERSION)" [ "$GITHUB_REF_NAME" = "$want" ] || { echo "tag $GITHUB_REF_NAME != $want"; exit 1; } # rust-toolchain.toml names the channel; `rustup show` installs it. # Never override the toolchain here. - name: Install the pinned toolchain shell: bash run: rustup show && rustup target add ${{ matrix.target }} - if: matrix.os == 'ubuntu-latest' run: sudo apt-get update && sudo apt-get install -y musl-tools - if: matrix.cross run: cargo install cross --locked - name: Build shell: bash run: ${{ matrix.cross && 'cross' || 'cargo' }} build --release -p impeccable --target ${{ matrix.target }} - name: Smoke the binary if: ${{ !matrix.cross }} shell: bash run: target/${{ matrix.target }}/release/impeccable${{ runner.os == 'Windows' && '.exe' || '' }} engine-probe - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: impeccable-${{ matrix.short }} path: target/${{ matrix.target }}/release/impeccable${{ runner.os == 'Windows' && '.exe' || '' }} if-no-files-found: error publish: needs: build runs-on: ubuntu-latest steps: - uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0 with: { path: artifacts } - name: Lay out release assets with checksums run: | set -e mkdir -p out for d in artifacts/impeccable-*; do short=$(basename "$d" | sed 's/^impeccable-//') f=$(ls "$d" | head -1) case "$short" in windows-*) dest="out/impeccable-$short.exe" ;; *) dest="out/impeccable-$short" ;; esac cp "$d/$f" "$dest" (cd out && sha256sum "$(basename "$dest")" > "$(basename "$dest").sha256") done ls -la out - name: Publish the GitHub Release env: { GH_TOKEN: "${{ github.token }}" } # No --clobber: a published asset is immutable. A re-run against an # existing release fails on the first existing asset instead of # silently replacing a binary and its sidecar hash. run: | set -e tag="${GITHUB_REF_NAME}" gh release create "$tag" --repo "$GITHUB_REPOSITORY" --title "impeccable engine $tag" \ --notes "Prebuilt impeccable engine binaries ($tag). The launcher, the npm shim and impeccable install download these on first run. Docs: https://impeccable.style" out/* || \ gh release upload "$tag" out/* --repo "$GITHUB_REPOSITORY"