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 permissions:
11 contents: read
12
13 env:
14 REPO: getsigit/sigit
15
16 jobs:
17 update-homebrew-tap:
18 name: Update Homebrew tap
19 runs-on: ubuntu-latest
20
21 steps:
22 - name: Resolve tag and version
23 id: release
24 shell: bash
25 run: |
26 TAG="${{ github.event.inputs.tag }}"
27 VERSION="${TAG#v}"
28
29 echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
30 echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
31
32 - name: Read SHA256 checksums from release
33 id: sha
34 env:
35 GH_TOKEN: ${{ github.token }}
36 shell: bash
37 run: |
38 mkdir -p artifacts
39
40 gh release download "${{ steps.release.outputs.tag }}" \
41 --repo "${{ env.REPO }}" \
42 --pattern "sigit-macos-*.tar.gz.sha256" \
43 --dir artifacts/
44
45 ARM64_SHA=$(cat artifacts/sigit-macos-arm64.tar.gz.sha256)
46 AMD64_SHA=$(cat artifacts/sigit-macos-amd64.tar.gz.sha256)
47
48 echo "arm64=${ARM64_SHA}" >> "$GITHUB_OUTPUT"
49 echo "amd64=${AMD64_SHA}" >> "$GITHUB_OUTPUT"
50
51 echo "ARM64 SHA256: ${ARM64_SHA}"
52 echo "AMD64 SHA256: ${AMD64_SHA}"
53
54 - name: Checkout Homebrew tap
55 uses: actions/checkout@v6
56 with:
57 repository: getsigit/homebrew-tap
58 token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
59 path: homebrew-tap
60
61 - name: Generate formula
62 shell: bash
63 run: |
64 VERSION="${{ steps.release.outputs.version }}"
65 TAG="${{ steps.release.outputs.tag }}"
66 ARM64_SHA="${{ steps.sha.outputs.arm64 }}"
67 AMD64_SHA="${{ steps.sha.outputs.amd64 }}"
68
69 mkdir -p homebrew-tap/Formula
70
71 cat > homebrew-tap/Formula/sigit.rb <<FORMULA
72 # frozen_string_literal: true
73
74 # Homebrew formula for siGit Code (\`sigit\` binary).
75 class Sigit < Formula
76 desc 'AI coding agent powered by local LLM via Onde Inference'
77 homepage 'https://github.com/getsigit/sigit'
78 version '${VERSION}'
79 license 'Apache-2.0'
80
81 on_macos do
82 on_arm do
83 url 'https://github.com/${REPO}/releases/download/${TAG}/sigit-macos-arm64.tar.gz'
84 sha256 '${ARM64_SHA}'
85 end
86 on_intel do
87 url 'https://github.com/${REPO}/releases/download/${TAG}/sigit-macos-amd64.tar.gz'
88 sha256 '${AMD64_SHA}'
89 end
90 end
91
92 def install
93 bin.install 'sigit'
94 end
95
96 test do
97 assert_match version.to_s, shell_output("#{bin}/sigit --version", 1)
98 end
99 end
100 FORMULA
101
102 echo "Generated formula:"
103 cat homebrew-tap/Formula/sigit.rb
104
105 - name: Commit and push
106 shell: bash
107 run: |
108 VERSION="${{ steps.release.outputs.version }}"
109
110 cd homebrew-tap
111 git config user.name "github-actions[bot]"
112 git config user.email "github-actions[bot]@users.noreply.github.com"
113 git add Formula/sigit.rb
114 git diff --cached --quiet && echo "No changes to commit" && exit 0
115 git commit -m "Update sigit to ${VERSION}"
116 git push