Skip to content

Commit 3226e8b

Browse files
authored
Merge pull request #4 from JNHFlow21/codex/homebrew-release
feat: add unsigned macOS release pipeline
2 parents 0851775 + 1e6da44 commit 3226e8b

4 files changed

Lines changed: 139 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,5 @@ jobs:
5454
- uses: actions/checkout@v7
5555
- run: zsh -n scripts/install.sh
5656
- run: test -x scripts/install.sh
57+
- run: zsh -n scripts/build-release.sh
58+
- run: test -x scripts/build-release.sh

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: macos-14
14+
steps:
15+
- uses: actions/checkout@v7
16+
- uses: actions/setup-python@v7
17+
with:
18+
python-version: "3.14"
19+
20+
- name: Verify tag and version
21+
shell: bash
22+
run: |
23+
set -euo pipefail
24+
version="$(cat VERSION)"
25+
test "$GITHUB_REF_NAME" = "v$version"
26+
PYTHONPATH=src python -c 'import agent_switch; print(agent_switch.__version__)'
27+
28+
- name: Run release tests
29+
run: |
30+
PYTHONPATH=src python -m unittest discover -s tests -v
31+
PYTHONPATH=src python -m unittest discover -s tests/integration -v
32+
33+
- name: Build release artifacts
34+
run: |
35+
python -m pip install --upgrade build
36+
python -m build --sdist --outdir dist
37+
./scripts/build-release.sh dist
38+
cd dist
39+
shasum -a 256 "agent_switch-$(cat ../VERSION).tar.gz" \
40+
> "agent_switch-$(cat ../VERSION).tar.gz.sha256"
41+
42+
- name: Create GitHub prerelease
43+
env:
44+
GH_TOKEN: ${{ github.token }}
45+
shell: bash
46+
run: |
47+
set -euo pipefail
48+
version="$(cat VERSION)"
49+
cat > "$RUNNER_TEMP/release-notes.md" <<EOF
50+
Agent Switch $version is an alpha release for macOS 14 and newer.
51+
52+
## Install
53+
54+
\`\`\`bash
55+
brew tap JNHFlow21/tap && brew trust --tap JNHFlow21/tap && HOMEBREW_CASK_OPTS=--no-quarantine brew install --cask JNHFlow21/tap/agent-switch
56+
\`\`\`
57+
58+
This build is ad-hoc signed and not notarized because the project does
59+
not yet have an Apple Developer ID. The install command deliberately
60+
disables Gatekeeper quarantine for this cask installation. Review the
61+
public source and checksums before installing.
62+
EOF
63+
gh release create "$GITHUB_REF_NAME" \
64+
dist/Agent-Switch-"$version"-macos-universal.zip \
65+
dist/Agent-Switch-"$version"-macos-universal.zip.sha256 \
66+
dist/agent_switch-"$version".tar.gz \
67+
dist/agent_switch-"$version".tar.gz.sha256 \
68+
--title "Agent Switch $version" \
69+
--notes-file "$RUNNER_TEMP/release-notes.md" \
70+
--prerelease

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to Agent Switch are documented here.
44

5-
## 0.2.0 - Unreleased
5+
## 0.2.0 - 2026-07-23
66

77
### Added
88

@@ -14,6 +14,8 @@ All notable changes to Agent Switch are documented here.
1414
- Native import preview showing MCP IDs and secret names before adoption.
1515
- Credential-to-MCP consumer mapping in status and the Secret UI.
1616
- Detected-agent-only reconciliation for clean first-run behavior.
17+
- Reproducible universal macOS release packaging for GitHub Releases.
18+
- Homebrew Formula and Cask distribution through the project-owned Tap.
1719

1820
### Security
1921

@@ -32,6 +34,7 @@ All notable changes to Agent Switch are documented here.
3234
source checkout when that CLI is available.
3335
- `doctor --strict` now fails for drift or missing required credentials as well
3436
as blocked targets.
37+
- The public alpha is ad-hoc signed and explicitly documented as not notarized.
3538

3639
## 0.1.3 - 2026-07-13
3740

scripts/build-release.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/zsh
2+
set -euo pipefail
3+
4+
ROOT="${0:A:h:h}"
5+
VERSION="$(<"$ROOT/VERSION")"
6+
PROJECT="$ROOT/macos-app/AgentSwitch/AgentSwitch.xcodeproj"
7+
SCHEME="AgentSwitch"
8+
OUTPUT_DIR="${1:-$ROOT/dist}"
9+
DERIVED_DATA="$(mktemp -d "${TMPDIR:-/tmp}/agent-switch-release.XXXXXX")"
10+
APP="$DERIVED_DATA/Build/Products/Release/Agent Switch.app"
11+
ARCHIVE="$OUTPUT_DIR/Agent-Switch-$VERSION-macos-universal.zip"
12+
13+
cleanup() {
14+
rm -rf "$DERIVED_DATA"
15+
}
16+
trap cleanup EXIT
17+
18+
fail() {
19+
print -u2 "Agent Switch release build failed: $*"
20+
exit 1
21+
}
22+
23+
[[ "$(uname -s)" == "Darwin" ]] || fail "macOS is required."
24+
for command in xcodebuild codesign ditto lipo shasum; do
25+
command -v "$command" >/dev/null 2>&1 || fail "$command is required."
26+
done
27+
28+
mkdir -p "$OUTPUT_DIR"
29+
rm -f "$ARCHIVE" "$ARCHIVE.sha256"
30+
31+
xcodebuild \
32+
-project "$PROJECT" \
33+
-scheme "$SCHEME" \
34+
-configuration Release \
35+
-destination "generic/platform=macOS" \
36+
-derivedDataPath "$DERIVED_DATA" \
37+
-quiet \
38+
ARCHS="arm64 x86_64" \
39+
ONLY_ACTIVE_ARCH=NO \
40+
CODE_SIGNING_ALLOWED=NO \
41+
build
42+
43+
[[ -d "$APP" ]] || fail "Xcode did not produce $APP"
44+
45+
APP_VERSION="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$APP/Contents/Info.plist")"
46+
[[ "$APP_VERSION" == "$VERSION" ]] || fail "App version $APP_VERSION does not match VERSION $VERSION."
47+
48+
ARCHS="$(lipo -archs "$APP/Contents/MacOS/Agent Switch")"
49+
[[ " $ARCHS " == *" arm64 "* ]] || fail "Release is missing arm64."
50+
[[ " $ARCHS " == *" x86_64 "* ]] || fail "Release is missing x86_64."
51+
52+
# The public alpha is intentionally ad-hoc signed until a Developer ID is
53+
# available. Homebrew installation documents the resulting Gatekeeper tradeoff.
54+
xattr -cr "$APP"
55+
codesign --force --sign - --options runtime --timestamp=none "$APP"
56+
codesign --verify --deep --strict --verbose=2 "$APP"
57+
58+
ditto -c -k --sequesterRsrc --keepParent "$APP" "$ARCHIVE"
59+
(cd "$OUTPUT_DIR" && shasum -a 256 "${ARCHIVE:t}" > "${ARCHIVE:t}.sha256")
60+
61+
print "Built $ARCHIVE"
62+
print "Architectures: $ARCHS"
63+
print "Signing: ad-hoc (not notarized)"

0 commit comments

Comments
 (0)