Skip to content

Commit 257a9d4

Browse files
ind-igoclaude
andcommitted
Switch Homebrew formula to prebuilt binaries
Instead of building from source with cargo install, the formula now downloads prebuilt binaries from GitHub releases. Supports macOS (ARM/Intel) and Linux (x86_64/aarch64). No Rust toolchain needed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent b36550a commit 257a9d4

1 file changed

Lines changed: 59 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,26 +92,74 @@ jobs:
9292
needs: release
9393
runs-on: ubuntu-latest
9494
steps:
95-
- name: Get version from tag
96-
id: version
97-
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
98-
- name: Compute tarball SHA256
99-
id: sha
95+
- name: Get version and compute SHA256s
96+
id: info
10097
run: |
101-
sha=$(curl -sLf "https://github.com/ind-igo/cx/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz" | sha256sum | cut -d' ' -f1)
102-
echo "sha256=$sha" >> "$GITHUB_OUTPUT"
98+
VERSION="${GITHUB_REF_NAME#v}"
99+
BASE="https://github.com/ind-igo/cx/releases/download/${GITHUB_REF_NAME}"
100+
ARM_SHA=$(curl -sLf "${BASE}/cx-aarch64-apple-darwin.tar.gz" | sha256sum | cut -d' ' -f1)
101+
X86_SHA=$(curl -sLf "${BASE}/cx-x86_64-apple-darwin.tar.gz" | sha256sum | cut -d' ' -f1)
102+
LINUX_SHA=$(curl -sLf "${BASE}/cx-x86_64-unknown-linux-gnu.tar.gz" | sha256sum | cut -d' ' -f1)
103+
LINUX_ARM_SHA=$(curl -sLf "${BASE}/cx-aarch64-unknown-linux-gnu.tar.gz" | sha256sum | cut -d' ' -f1)
104+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
105+
echo "arm_sha=$ARM_SHA" >> "$GITHUB_OUTPUT"
106+
echo "x86_sha=$X86_SHA" >> "$GITHUB_OUTPUT"
107+
echo "linux_sha=$LINUX_SHA" >> "$GITHUB_OUTPUT"
108+
echo "linux_arm_sha=$LINUX_ARM_SHA" >> "$GITHUB_OUTPUT"
103109
- name: Update Homebrew tap
104110
env:
105111
TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
106112
run: |
107-
VERSION="${GITHUB_REF_NAME#v}"
108-
SHA="${{ steps.sha.outputs.sha256 }}"
113+
VERSION="${{ steps.info.outputs.version }}"
114+
TAG="${GITHUB_REF_NAME}"
115+
ARM_SHA="${{ steps.info.outputs.arm_sha }}"
116+
X86_SHA="${{ steps.info.outputs.x86_sha }}"
117+
LINUX_SHA="${{ steps.info.outputs.linux_sha }}"
118+
LINUX_ARM_SHA="${{ steps.info.outputs.linux_arm_sha }}"
119+
BASE="https://github.com/ind-igo/cx/releases/download/${TAG}"
120+
109121
git clone https://x-access-token:${TAP_TOKEN}@github.com/ind-igo/homebrew-cx.git
110122
cd homebrew-cx
111123
git config user.name "github-actions[bot]"
112124
git config user.email "github-actions[bot]@users.noreply.github.com"
113-
sed -i "s|url \".*\"|url \"https://github.com/ind-igo/cx/archive/refs/tags/${GITHUB_REF_NAME}.tar.gz\"|" Formula/cx.rb
114-
sed -i "s|sha256 \".*\"|sha256 \"${SHA}\"|" Formula/cx.rb
125+
126+
cat > Formula/cx.rb << FORMULA
127+
class Cx < Formula
128+
desc "Semantic code navigation for AI agents"
129+
homepage "https://github.com/ind-igo/cx"
130+
version "${VERSION}"
131+
license "MIT"
132+
133+
on_macos do
134+
if Hardware::CPU.arm?
135+
url "${BASE}/cx-aarch64-apple-darwin.tar.gz"
136+
sha256 "${ARM_SHA}"
137+
else
138+
url "${BASE}/cx-x86_64-apple-darwin.tar.gz"
139+
sha256 "${X86_SHA}"
140+
end
141+
end
142+
143+
on_linux do
144+
if Hardware::CPU.arm?
145+
url "${BASE}/cx-aarch64-unknown-linux-gnu.tar.gz"
146+
sha256 "${LINUX_ARM_SHA}"
147+
else
148+
url "${BASE}/cx-x86_64-unknown-linux-gnu.tar.gz"
149+
sha256 "${LINUX_SHA}"
150+
end
151+
end
152+
153+
def install
154+
bin.install "cx"
155+
end
156+
157+
test do
158+
assert_match version.to_s, shell_output("#{bin}/cx --version")
159+
end
160+
end
161+
FORMULA
162+
115163
git add Formula/cx.rb
116164
git diff --staged --quiet && exit 0
117165
git commit -m "cx ${VERSION}"

0 commit comments

Comments
 (0)