1 name: Homebrew CLI Release
2
3 on:
4 workflow_dispatch:
5 inputs:
6 tag:
7 description: "Release tag (e.g. v0.1.1)"
8 required: true
9
10 concurrency:
11 # A re-pushed or re-dispatched tag fires this a second time. Queue the
12 # duplicate behind the original instead of cancelling it: cancelling a run
13 # mid-publish can leave a channel half-uploaded, whereas a queued duplicate
14 # just hits the "already published" check and exits clean.
15 group: ${{ github.workflow }}-${{ github.event.inputs.tag || github.ref_name }}
16 cancel-in-progress: false
17
18 permissions:
19 contents: read
20
21 env:
22 REPO: getsigit/sigit
23
24 jobs:
25 update-homebrew-tap:
26 name: Update Homebrew tap
27 runs-on: ubuntu-latest
28
29 steps:
30 - name: Resolve tag and version
31 id: release
32 shell: bash
33 run: |
34 TAG="${{ github.event.inputs.tag }}"
35 VERSION="${TAG#v}"
36
37 echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
38 echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
39
40 - name: Read SHA256 checksums from release
41 id: sha
42 env:
43 GH_TOKEN: ${{ github.token }}
44 shell: bash
45 run: |
46 mkdir -p artifacts
47
48 gh release download "${{ steps.release.outputs.tag }}" \
49 --repo "${{ env.REPO }}" \
50 --pattern "sigit-macos-*.tar.gz.sha256" \
51 --dir artifacts/
52
53 ARM64_SHA=$(cat artifacts/sigit-macos-arm64.tar.gz.sha256)
54 AMD64_SHA=$(cat artifacts/sigit-macos-amd64.tar.gz.sha256)
55
56 echo "arm64=${ARM64_SHA}" >> "$GITHUB_OUTPUT"
57 echo "amd64=${AMD64_SHA}" >> "$GITHUB_OUTPUT"
58
59 echo "ARM64 SHA256: ${ARM64_SHA}"
60 echo "AMD64 SHA256: ${AMD64_SHA}"
61
62 - name: Checkout Homebrew tap
63 uses: actions/checkout@v6
64 with:
65 repository: getsigit/homebrew-tap
66 token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
67 path: homebrew-tap
68
69 - name: Generate formula
70 shell: bash
71 run: |
72 VERSION="${{ steps.release.outputs.version }}"
73 TAG="${{ steps.release.outputs.tag }}"
74 ARM64_SHA="${{ steps.sha.outputs.arm64 }}"
75 AMD64_SHA="${{ steps.sha.outputs.amd64 }}"
76
77 mkdir -p homebrew-tap/Formula
78
79 cat > homebrew-tap/Formula/sigit.rb <<FORMULA
80 # frozen_string_literal: true
81
82 # Homebrew formula for siGit Code (\`sigit\` binary).
83 class Sigit < Formula
84 desc 'AI coding agent powered by local LLM via Onde Inference'
85 homepage 'https://github.com/getsigit/sigit'
86 version '${VERSION}'
87 license 'Apache-2.0'
88
89 on_macos do
90 on_arm do
91 url 'https://github.com/${REPO}/releases/download/${TAG}/sigit-macos-arm64.tar.gz'
92 sha256 '${ARM64_SHA}'
93 end
94 on_intel do
95 url 'https://github.com/${REPO}/releases/download/${TAG}/sigit-macos-amd64.tar.gz'
96 sha256 '${AMD64_SHA}'
97 end
98 end
99
100 def install
101 bin.install 'sigit'
102 end
103
104 test do
105 assert_match version.to_s, shell_output("#{bin}/sigit --version", 1)
106 end
107 end
108 FORMULA
109
110 echo "Generated formula:"
111 cat homebrew-tap/Formula/sigit.rb
112
113 - name: Commit and push
114 shell: bash
115 run: |
116 VERSION="${{ steps.release.outputs.version }}"
117
118 cd homebrew-tap
119 git config user.name "github-actions[bot]"
120 git config user.email "github-actions[bot]@users.noreply.github.com"
121 git add Formula/sigit.rb
122 git diff --cached --quiet && echo "No changes to commit" && exit 0
123 git commit -m "Update sigit to ${VERSION}"
124 git push