Skip to content

Commit 76a93de

Browse files
committed
brew support
1 parent 63626d4 commit 76a93de

File tree

3 files changed

+70
-2
lines changed

3 files changed

+70
-2
lines changed

.github/workflows/brew.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Homebrew Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Get version
17+
id: get_version
18+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
19+
20+
- name: Create Release
21+
id: create_release
22+
uses: softprops/action-gh-release@v1
23+
with:
24+
files: |
25+
dist/*.tar.gz
26+
draft: false
27+
prerelease: false
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Update Homebrew Formula
32+
uses: dawidd6/action-homebrew-bump-formula@v3
33+
with:
34+
formula-name: gcx
35+
homebrew-tap: sxwebdev/homebrew-tap
36+
download-url: |
37+
https://github.com/sxwebdev/gcx/releases/download/${{ steps.get_version.outputs.VERSION }}/gcx_${{ steps.get_version.outputs.VERSION }}_darwin_amd64.tar.gz
38+
https://github.com/sxwebdev/gcx/releases/download/${{ steps.get_version.outputs.VERSION }}/gcx_${{ steps.get_version.outputs.VERSION }}_darwin_arm64.tar.gz
39+
commit-message: "chore: bump gcx to ${{ steps.get_version.outputs.VERSION }}"
40+
env:
41+
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}

Formula/gcx.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class Gcx < Formula
2+
desc "A tool for cross-compiling and publishing Go binaries"
3+
homepage "https://github.com/sxwebdev/gcx"
4+
url "https://github.com/sxwebdev/gcx/archive/refs/tags/v0.0.1.tar.gz"
5+
sha256 ""
6+
7+
depends_on "go" => :build
8+
9+
def install
10+
if Hardware::CPU.intel?
11+
url = "https://github.com/sxwebdev/gcx/releases/download/#{version}/gcx_#{version}_darwin_amd64.tar.gz"
12+
else
13+
url = "https://github.com/sxwebdev/gcx/releases/download/#{version}/gcx_#{version}_darwin_arm64.tar.gz"
14+
end
15+
16+
system "curl", "-L", url, "-o", "gcx.tar.gz"
17+
system "tar", "xzf", "gcx.tar.gz"
18+
bin.install "gcx"
19+
end
20+
21+
test do
22+
system "#{bin}/gcx", "version"
23+
end
24+
end

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@
1919
You can download the pre-built binary from the [releases](https://github.com/sxwebdev/gcx/releases) page or build it from source:
2020

2121
```bash
22-
go install github.com/sxwebdev/gcx@latest
22+
# Install via Homebrew
23+
brew install sxwebdev/tap/gcx
2324

24-
# or
25+
# Or install from source
26+
go install github.com/sxwebdev/gcx@latest
2527

28+
# Or build from source
2629
git clone https://github.com/sxwebdev/gcx.git
2730
cd gcx
2831
make build

0 commit comments

Comments
 (0)