Skip to content

Commit dce9961

Browse files
cameroncookeclaude
andcommitted
ci(release): Host test Homebrew artifacts from tap repo
Allow formula generation to accept a configurable base URL. For workflow_dispatch runs, publish portable archives into the tap repo and point formula URLs at raw artifact paths so Homebrew install can be tested end-to-end without creating GitHub releases or publishing to npm. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 355606f commit dce9961

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,17 @@ jobs:
395395
if: env.HOMEBREW_TAP_TOKEN != ''
396396
run: |
397397
VERSION="${{ needs.release.outputs.version }}"
398+
FORMULA_BASE_URL="https://github.com/cameroncooke/XcodeBuildMCP/releases/download/v${VERSION}"
399+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
400+
FORMULA_BASE_URL="https://raw.githubusercontent.com/cameroncooke/homebrew-xcodebuildmcp/main/artifacts/${VERSION}"
401+
fi
398402
ARM64_SHA="$(awk '{print $1}' dist/portable/arm64/xcodebuildmcp-${VERSION}-darwin-arm64.tar.gz.sha256)"
399403
X64_SHA="$(awk '{print $1}' dist/portable/x64/xcodebuildmcp-${VERSION}-darwin-x64.tar.gz.sha256)"
400404
npm run homebrew:formula -- \
401405
--version "$VERSION" \
402406
--arm64-sha "$ARM64_SHA" \
403407
--x64-sha "$X64_SHA" \
408+
--base-url "$FORMULA_BASE_URL" \
404409
--out dist/homebrew/Formula/xcodebuildmcp.rb
405410
406411
- name: Create pull request in tap repo
@@ -411,8 +416,19 @@ jobs:
411416
VERSION="${{ needs.release.outputs.version }}"
412417
BRANCH="xcodebuildmcp-v${VERSION}"
413418
DEFAULT_BRANCH="main"
419+
ADD_TAP_ARTIFACTS="false"
420+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
421+
ADD_TAP_ARTIFACTS="true"
422+
fi
414423
git clone "https://x-access-token:${GH_TOKEN}@github.com/cameroncooke/homebrew-xcodebuildmcp.git" tap-repo
415424
mkdir -p tap-repo/Formula
425+
if [ "$ADD_TAP_ARTIFACTS" = "true" ]; then
426+
mkdir -p "tap-repo/artifacts/${VERSION}"
427+
cp "dist/portable/arm64/xcodebuildmcp-${VERSION}-darwin-arm64.tar.gz" "tap-repo/artifacts/${VERSION}/"
428+
cp "dist/portable/arm64/xcodebuildmcp-${VERSION}-darwin-arm64.tar.gz.sha256" "tap-repo/artifacts/${VERSION}/"
429+
cp "dist/portable/x64/xcodebuildmcp-${VERSION}-darwin-x64.tar.gz" "tap-repo/artifacts/${VERSION}/"
430+
cp "dist/portable/x64/xcodebuildmcp-${VERSION}-darwin-x64.tar.gz.sha256" "tap-repo/artifacts/${VERSION}/"
431+
fi
416432
cp dist/homebrew/Formula/xcodebuildmcp.rb tap-repo/Formula/xcodebuildmcp.rb
417433
cd tap-repo
418434
git config user.name "github-actions[bot]"
@@ -421,6 +437,9 @@ jobs:
421437
echo "Tap repo has no commits; bootstrapping ${DEFAULT_BRANCH}."
422438
git checkout -b "$DEFAULT_BRANCH"
423439
git add Formula/xcodebuildmcp.rb
440+
if [ "$ADD_TAP_ARTIFACTS" = "true" ]; then
441+
git add "artifacts/${VERSION}"
442+
fi
424443
git commit -m "Initialize xcodebuildmcp formula ${VERSION}"
425444
git push origin "$DEFAULT_BRANCH"
426445
exit 0
@@ -435,6 +454,9 @@ jobs:
435454
fi
436455
git checkout -B "$BRANCH"
437456
git add Formula/xcodebuildmcp.rb
457+
if [ "$ADD_TAP_ARTIFACTS" = "true" ]; then
458+
git add "artifacts/${VERSION}"
459+
fi
438460
git commit -m "xcodebuildmcp ${VERSION}"
439461
git push --set-upstream origin "$BRANCH"
440462
gh pr create \

scripts/create-homebrew-formula.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ VERSION=""
66
ARM64_SHA=""
77
X64_SHA=""
88
OUT_PATH=""
9+
BASE_URL=""
910

1011
usage() {
1112
cat <<'EOF'
1213
Usage:
13-
scripts/create-homebrew-formula.sh --version <semver> --arm64-sha <sha256> --x64-sha <sha256> [--out <path>]
14+
scripts/create-homebrew-formula.sh --version <semver> --arm64-sha <sha256> --x64-sha <sha256> [--base-url <url>] [--out <path>]
1415
EOF
1516
}
1617

@@ -28,6 +29,10 @@ while [[ $# -gt 0 ]]; do
2829
X64_SHA="${2:-}"
2930
shift 2
3031
;;
32+
--base-url)
33+
BASE_URL="${2:-}"
34+
shift 2
35+
;;
3136
--out)
3237
OUT_PATH="${2:-}"
3338
shift 2
@@ -49,6 +54,10 @@ if [[ -z "$VERSION" || -z "$ARM64_SHA" || -z "$X64_SHA" ]]; then
4954
exit 1
5055
fi
5156

57+
if [[ -z "$BASE_URL" ]]; then
58+
BASE_URL="https://github.com/cameroncooke/XcodeBuildMCP/releases/download/v$VERSION"
59+
fi
60+
5261
FORMULA_CONTENT="$(cat <<EOF
5362
class Xcodebuildmcp < Formula
5463
desc "Model Context Protocol server for Xcode project workflows"
@@ -57,12 +66,12 @@ class Xcodebuildmcp < Formula
5766
version "$VERSION"
5867
5968
on_arm do
60-
url "https://github.com/cameroncooke/XcodeBuildMCP/releases/download/v$VERSION/xcodebuildmcp-$VERSION-darwin-arm64.tar.gz"
69+
url "$BASE_URL/xcodebuildmcp-$VERSION-darwin-arm64.tar.gz"
6170
sha256 "$ARM64_SHA"
6271
end
6372
6473
on_intel do
65-
url "https://github.com/cameroncooke/XcodeBuildMCP/releases/download/v$VERSION/xcodebuildmcp-$VERSION-darwin-x64.tar.gz"
74+
url "$BASE_URL/xcodebuildmcp-$VERSION-darwin-x64.tar.gz"
6675
sha256 "$X64_SHA"
6776
end
6877

0 commit comments

Comments
 (0)