Skip to content

Commit 219e52e

Browse files
committed
ci: auto-update Homebrew on release, add Windows to CI matrix
1 parent b6ac95d commit 219e52e

2 files changed

Lines changed: 71 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
matrix:
18-
os: [ubuntu-latest, macos-latest]
18+
os: [ubuntu-latest, macos-latest, windows-latest]
1919
node-version: [20, 22]
2020
fail-fast: false
2121

.github/workflows/publish.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,73 @@ jobs:
4242
run: npm publish --access public
4343
env:
4444
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
45+
46+
update-homebrew:
47+
name: Update Homebrew Formula
48+
needs: publish
49+
runs-on: ubuntu-latest
50+
permissions:
51+
contents: read
52+
53+
steps:
54+
- name: Wait for npm registry propagation
55+
run: sleep 30
56+
57+
- name: Get version from tag
58+
id: version
59+
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
60+
61+
- name: Download tarball and compute SHA
62+
id: sha
63+
run: |
64+
URL="https://registry.npmjs.org/@sunilp-org/jam-cli/-/jam-cli-${{ steps.version.outputs.version }}.tgz"
65+
# Retry up to 3 times in case registry hasn't propagated yet
66+
for i in 1 2 3; do
67+
HTTP_CODE=$(curl -s -o /tmp/jam.tgz -w "%{http_code}" "$URL")
68+
if [ "$HTTP_CODE" = "200" ]; then break; fi
69+
echo "Attempt $i: got $HTTP_CODE, retrying in 15s..."
70+
sleep 15
71+
done
72+
SHA=$(sha256sum /tmp/jam.tgz | awk '{print $1}')
73+
echo "sha256=$SHA" >> "$GITHUB_OUTPUT"
74+
echo "url=$URL" >> "$GITHUB_OUTPUT"
75+
76+
- name: Checkout homebrew-tap
77+
uses: actions/checkout@v5
78+
with:
79+
repository: sunilp/homebrew-tap
80+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
81+
path: homebrew-tap
82+
83+
- name: Update formula
84+
run: |
85+
cat > homebrew-tap/Formula/jam-cli.rb << 'FORMULA'
86+
class JamCli < Formula
87+
desc "Developer-first AI CLI for cross-language code intelligence"
88+
homepage "https://jam.sunilprakash.com"
89+
url "${{ steps.sha.outputs.url }}"
90+
sha256 "${{ steps.sha.outputs.sha256 }}"
91+
license "MIT"
92+
93+
depends_on "node@20"
94+
95+
def install
96+
system "npm", "install", *std_npm_args
97+
bin.install_symlink Dir["#{libexec}/bin/*"]
98+
end
99+
100+
test do
101+
assert_match version.to_s, shell_output("#{bin}/jam --version")
102+
end
103+
end
104+
FORMULA
105+
106+
- name: Push formula update
107+
working-directory: homebrew-tap
108+
run: |
109+
git config user.name "github-actions[bot]"
110+
git config user.email "github-actions[bot]@users.noreply.github.com"
111+
git add Formula/jam-cli.rb
112+
git diff --cached --quiet && echo "No changes" && exit 0
113+
git commit -m "chore: bump jam-cli to ${{ steps.version.outputs.version }}"
114+
git push

0 commit comments

Comments
 (0)