diff --git a/.github/workflows/patched-release-darwin.yml b/.github/workflows/patched-release-darwin.yml new file mode 100644 index 000000000000..7f2bfcb9f240 --- /dev/null +++ b/.github/workflows/patched-release-darwin.yml @@ -0,0 +1,81 @@ +# Adds the aarch64-apple-darwin CLI to an EXISTING patched-* release that was published +# before patched-release.yml built darwin. The binary is built from the release's own tag, +# so it is the same source as the Linux assets already on that release; the Linux assets +# are left untouched and SHA256SUMS is regenerated over every asset. It refuses a release +# that already has darwin assets. +# +# Run: push a tag named darwin-backfill-, e.g. darwin-backfill-patched-1.54.0.15, +# at any commit that has this file (the build checks out the release tag, not the pushed one). +# A tag push rather than workflow_dispatch: dispatch needs the file on the default branch, +# which here is an upstream mirror. +on: + push: + tags: + - "darwin-backfill-patched-*" + +name: "Patched release (darwin backfill)" + +permissions: + contents: read + +jobs: + check: + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.resolve.outputs.tag }} + sha: ${{ steps.resolve.outputs.sha }} + steps: + - id: resolve + env: + GH_TOKEN: ${{ github.token }} + PUSHED: ${{ github.ref_name }} + run: | + TAG="${PUSHED#darwin-backfill-}" + case "$TAG" in patched-*) ;; *) echo "not a patched-* tag: $TAG" >&2; exit 1 ;; esac + gh release view "$TAG" --repo "$GITHUB_REPOSITORY" > /dev/null + sha="$(gh api "repos/$GITHUB_REPOSITORY/commits/$TAG" --jq .sha)" + test -n "$sha" + # A Rust build is not reproducible: replacing a darwin asset would break every + # pinned hash of it. Refuse rather than clobber; delete the asset by hand to redo. + if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets[].name' \ + | grep -qx 'goose-aarch64-apple-darwin.tar.gz'; then + echo "$TAG already has darwin assets; refusing to replace them" >&2 + exit 1 + fi + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + echo "sha=$sha" >> "$GITHUB_OUTPUT" + + build-macos: + needs: check + uses: ./.github/workflows/bundle-macos.yml + permissions: + contents: read + with: + target: aarch64-apple-darwin + package_cli: true + package_desktop: false + signing: false + ref: ${{ needs.check.outputs.sha }} + + upload: + needs: [check, build-macos] + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/download-artifact@v4 + with: + name: goose-aarch64-apple-darwin + path: dist + - name: Upload to the release + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ needs.check.outputs.tag }} + run: | + test -f dist/goose-aarch64-apple-darwin.tar.gz + mkdir all + gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --dir all --pattern 'goose-*' + cp dist/* all/ + (cd all && sha256sum goose-* > SHA256SUMS && cat SHA256SUMS) + gh release upload "$TAG" dist/* --repo "$GITHUB_REPOSITORY" + gh release upload "$TAG" all/SHA256SUMS --repo "$GITHUB_REPOSITORY" --clobber diff --git a/.github/workflows/patched-release.yml b/.github/workflows/patched-release.yml index f71f2a15bac6..fa35df16ea3a 100644 --- a/.github/workflows/patched-release.yml +++ b/.github/workflows/patched-release.yml @@ -1,7 +1,11 @@ -# Modified by Jonathan Mohrbacher, 2026: test-patches runs subdirectory hints tests; test-patches runs message id / truncate_from_message tests. +# Modified by Jonathan Mohrbacher, 2026: test-patches runs subdirectory hints tests; test-patches runs message id / truncate_from_message tests; the release also carries the aarch64-apple-darwin CLI. # Builds this branch (an upstream release tag plus a few local patches) with upstream's own -# Linux CLI build workflow, so the result differs from the upstream release only by the patches, -# and publishes the gnu tarballs as a release of this fork. +# Linux CLI build workflow and upstream's macOS bundle workflow (CLI only, unsigned), so the result +# differs from the upstream release only by the patches, and publishes the gnu tarballs and the +# aarch64-apple-darwin tarballs as a release of this fork. +# +# A release made before the darwin build was added gets its darwin assets from +# patched-release-darwin.yml (push a darwin-backfill- tag). # # Run: push a tag named patched-., e.g. patched-1.54.0.1, on the patched branch. # The name must not start with "v": upstream's release.yml and publish-docker.yml fire on v* tags. @@ -23,6 +27,20 @@ jobs: with: ref: ${{ github.sha }} + # The Mac runs the same patched goose as the Linux hosts (workstation pkgs/goose). + # Unsigned: the Nix fetch never sets a quarantine attribute, and the linker's ad-hoc + # signature is all Apple Silicon needs to exec a binary. + build-macos: + uses: ./.github/workflows/bundle-macos.yml + permissions: + contents: read + with: + target: aarch64-apple-darwin + package_cli: true + package_desktop: false + signing: false + ref: ${{ github.sha }} + # Unit tests for the patched code paths (including the vendored acp-http crate), on the same toolchain. test-patches: runs-on: ubuntu-24.04-arm @@ -51,7 +69,7 @@ jobs: cargo test --release -p agent-client-protocol-http --features server --lib release: - needs: [build, test-patches] + needs: [build, build-macos, test-patches] if: ${{ !cancelled() && needs.test-patches.result == 'success' }} runs-on: ubuntu-latest permissions: @@ -62,6 +80,10 @@ jobs: pattern: goose-*-unknown-linux-gnu merge-multiple: true path: dist + - uses: actions/download-artifact@v4 + with: + name: goose-aarch64-apple-darwin + path: dist - name: Create release env: GH_TOKEN: ${{ github.token }} @@ -69,6 +91,7 @@ jobs: run: | ls -la dist test -f dist/goose-aarch64-unknown-linux-gnu.tar.gz + test -f dist/goose-aarch64-apple-darwin.tar.gz (cd dist && sha256sum * > SHA256SUMS) gh release create "$TAG" dist/* --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" \ --title "$TAG" --notes "Upstream goose v$(echo "$TAG" | sed -E 's/^patched-([0-9]+[.][0-9]+[.][0-9]+).*/\1/') plus the local patches committed after that tag at $GITHUB_SHA."