Skip to content

Commit d7150fd

Browse files
m2declaude
andcommitted
Switch Homebrew formula to prebuilt binaries
Replace source build (depends_on "rust") with architecture-specific prebuilt binary downloads using on_arm/on_intel blocks. Update the release workflow to generate the formula with computed SHA256 hashes and push directly to the tap repo, replacing the bump-homebrew-formula action which doesn't support multi-architecture formulas. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 259263b commit d7150fd

2 files changed

Lines changed: 57 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,51 @@ jobs:
197197
needs: github-release
198198
runs-on: ubuntu-latest
199199
steps:
200-
- uses: mislav/bump-homebrew-formula-action@v3
201-
with:
202-
formula-name: getapi
203-
homebrew-tap: m2de/homebrew-tap
204-
download-url: https://github.com/m2de/getapi/archive/refs/tags/${{ github.ref_name }}.tar.gz
200+
- name: Update Homebrew formula
205201
env:
206202
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
203+
run: |
204+
VERSION="${GITHUB_REF_NAME#v}"
205+
206+
ARM_URL="https://github.com/m2de/getapi/releases/download/${GITHUB_REF_NAME}/getapi-aarch64-apple-darwin.tar.gz"
207+
X64_URL="https://github.com/m2de/getapi/releases/download/${GITHUB_REF_NAME}/getapi-x86_64-apple-darwin.tar.gz"
208+
209+
ARM_SHA=$(curl -sL "$ARM_URL" | sha256sum | cut -d' ' -f1)
210+
X64_SHA=$(curl -sL "$X64_URL" | sha256sum | cut -d' ' -f1)
211+
212+
cat > /tmp/getapi.rb <<FORMULA
213+
class Getapi < Formula
214+
desc "Guided, interactive walkthroughs for setting up developer API credentials"
215+
homepage "https://github.com/m2de/getapi"
216+
version "${VERSION}"
217+
license "MIT"
218+
219+
on_arm do
220+
url "${ARM_URL}"
221+
sha256 "${ARM_SHA}"
222+
end
223+
224+
on_intel do
225+
url "${X64_URL}"
226+
sha256 "${X64_SHA}"
227+
end
228+
229+
def install
230+
bin.install "getapi"
231+
end
232+
233+
test do
234+
assert_match "getapi", shell_output("#{bin}/getapi --help")
235+
end
236+
end
237+
FORMULA
238+
239+
# Push to tap repo
240+
git clone "https://x-access-token:${COMMITTER_TOKEN}@github.com/m2de/homebrew-tap.git" /tmp/tap
241+
cp /tmp/getapi.rb /tmp/tap/Formula/getapi.rb
242+
cd /tmp/tap
243+
git config user.name "github-actions[bot]"
244+
git config user.email "github-actions[bot]@users.noreply.github.com"
245+
git add Formula/getapi.rb
246+
git commit -m "Update getapi to ${VERSION}"
247+
git push

homebrew/getapi.rb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
class Getapi < Formula
22
desc "Guided, interactive walkthroughs for setting up developer API credentials"
33
homepage "https://github.com/m2de/getapi"
4-
url "https://github.com/m2de/getapi/archive/refs/tags/v1.0.0.tar.gz"
5-
sha256 "eb4a3b6666894628d8d66494c69eb5a1389749bc945bf9381924a399549995d7"
4+
version "1.0.0"
65
license "MIT"
76

8-
depends_on "rust" => :build
7+
on_arm do
8+
url "https://github.com/m2de/getapi/releases/download/v1.0.0/getapi-aarch64-apple-darwin.tar.gz"
9+
sha256 "20e0baf8ffd4b9c559911e1ff926aafb167e48445456aead9eec18c67ad7fa15"
10+
end
11+
12+
on_intel do
13+
url "https://github.com/m2de/getapi/releases/download/v1.0.0/getapi-x86_64-apple-darwin.tar.gz"
14+
sha256 "0258c369d1687d481f34a5638b19068a5238c09345505e9993ab1ecf3694df28"
15+
end
916

1017
def install
11-
system "cargo", "install", *std_cargo_args
18+
bin.install "getapi"
1219
end
1320

1421
test do

0 commit comments

Comments
 (0)