Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .github/workflows/patched-release-darwin.yml
Original file line number Diff line number Diff line change
@@ -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-<release tag>, 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
31 changes: 27 additions & 4 deletions .github/workflows/patched-release.yml
Original file line number Diff line number Diff line change
@@ -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> tag).
#
# Run: push a tag named patched-<upstream version>.<n>, 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.
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -62,13 +80,18 @@ 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 }}
TAG: ${{ github.ref_name }}
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."