Skip to content

Commit 96836dd

Browse files
unhappychoiceclaude
andcommitted
feat: update Homebrew to use prebuilt binaries and add ARM64 support
- Update Homebrew formula to use prebuilt binaries instead of cargo install - Add Linux ARM64 support for M1/M2 Mac compatibility in Docker/VM environments - Improve installation speed by eliminating Rust compilation requirement - Support 5 architectures: x86_64/aarch64 Linux, x86_64 Windows, x86_64/aarch64 macOS 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent afb6767 commit 96836dd

File tree

1 file changed

+38
-7
lines changed

1 file changed

+38
-7
lines changed

.github/workflows/release.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ jobs:
116116
include:
117117
- target: x86_64-unknown-linux-gnu
118118
os: ubuntu-latest
119+
- target: aarch64-unknown-linux-gnu
120+
os: ubuntu-latest
119121
- target: x86_64-pc-windows-msvc
120122
os: windows-latest
121123
- target: x86_64-apple-darwin
@@ -193,17 +195,46 @@ jobs:
193195

194196
- name: Update Homebrew formula
195197
run: |
196-
# Calculate the SHA256 of the source tarball
197-
TARBALL_URL="https://github.com/unhappychoice/gittype/archive/${{ needs.release.outputs.new_version }}.tar.gz"
198-
SHA256=$(curl -sL "$TARBALL_URL" | sha256sum | cut -d' ' -f1)
198+
# Calculate SHA256 for each binary release
199+
VERSION=${{ needs.release.outputs.new_version }}
200+
201+
# macOS Intel
202+
MACOS_INTEL_URL="https://github.com/unhappychoice/gittype/releases/download/$VERSION/gittype-$VERSION-x86_64-apple-darwin.tar.gz"
203+
MACOS_INTEL_SHA=$(curl -sL "$MACOS_INTEL_URL" | sha256sum | cut -d' ' -f1)
204+
205+
# macOS ARM
206+
MACOS_ARM_URL="https://github.com/unhappychoice/gittype/releases/download/$VERSION/gittype-$VERSION-aarch64-apple-darwin.tar.gz"
207+
MACOS_ARM_SHA=$(curl -sL "$MACOS_ARM_URL" | sha256sum | cut -d' ' -f1)
199208
200-
# Update the formula
201-
sed -i "s|url \".*\"|url \"$TARBALL_URL\"|" homebrew-tap/Formula/gittype.rb
202-
sed -i "s|sha256 \".*\"|sha256 \"$SHA256\"|" homebrew-tap/Formula/gittype.rb
209+
# Linux Intel
210+
LINUX_INTEL_URL="https://github.com/unhappychoice/gittype/releases/download/$VERSION/gittype-$VERSION-x86_64-unknown-linux-gnu.tar.gz"
211+
LINUX_INTEL_SHA=$(curl -sL "$LINUX_INTEL_URL" | sha256sum | cut -d' ' -f1)
203212
213+
# Linux ARM64
214+
LINUX_ARM_URL="https://github.com/unhappychoice/gittype/releases/download/$VERSION/gittype-$VERSION-aarch64-unknown-linux-gnu.tar.gz"
215+
LINUX_ARM_SHA=$(curl -sL "$LINUX_ARM_URL" | sha256sum | cut -d' ' -f1)
216+
217+
# Update the formula with new URLs and SHA256s
204218
cd homebrew-tap
219+
220+
# Update macOS Intel
221+
sed -i "/on_macos do/,/on_intel do/,/end/ s|url \".*\"|url \"$MACOS_INTEL_URL\"|" Formula/gittype.rb
222+
sed -i "/on_macos do/,/on_intel do/,/end/ s|sha256 \".*\"|sha256 \"$MACOS_INTEL_SHA\"|" Formula/gittype.rb
223+
224+
# Update macOS ARM
225+
sed -i "/on_macos do/,/on_arm do/,/end/ s|url \".*\"|url \"$MACOS_ARM_URL\"|" Formula/gittype.rb
226+
sed -i "/on_macos do/,/on_arm do/,/end/ s|sha256 \".*\"|sha256 \"$MACOS_ARM_SHA\"|" Formula/gittype.rb
227+
228+
# Update Linux Intel
229+
sed -i "/on_linux do/,/on_intel do/,/end/ s|url \".*\"|url \"$LINUX_INTEL_URL\"|" Formula/gittype.rb
230+
sed -i "/on_linux do/,/on_intel do/,/end/ s|sha256 \".*\"|sha256 \"$LINUX_INTEL_SHA\"|" Formula/gittype.rb
231+
232+
# Update Linux ARM
233+
sed -i "/on_linux do/,/on_arm do/,/end/ s|url \".*\"|url \"$LINUX_ARM_URL\"|" Formula/gittype.rb
234+
sed -i "/on_linux do/,/on_arm do/,/end/ s|sha256 \".*\"|sha256 \"$LINUX_ARM_SHA\"|" Formula/gittype.rb
235+
205236
git config --local user.email "action@github.com"
206237
git config --local user.name "GitHub Action"
207238
git add Formula/gittype.rb
208-
git commit -m "chore: update gittype to ${{ needs.release.outputs.new_version }}"
239+
git commit -m "chore: update gittype to $VERSION"
209240
git push

0 commit comments

Comments
 (0)