Skip to content

Commit 79af089

Browse files
Wire Homebrew tap update via PR + read version from package.json (#12)
- Release workflow: compute Linux x64 SHA alongside macOS SHAs, switch from direct-push to opening a PR via peter-evans/create-pull-request so tap changes are auditable and human-driven edits can't silently clobber bot updates. - src/index.ts: read version from package.json at runtime so `apollo --version` always matches the published release tag. - package.json: bump to 0.5.1 (first release to carry the correct version string in the binary). - README: add Homebrew install section. Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent 462520a commit 79af089

4 files changed

Lines changed: 40 additions & 12 deletions

File tree

.github/workflows/release.yml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,33 @@ jobs:
5151
repository: apolloio/homebrew-apollo-io-cli
5252
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
5353

54-
- name: Download release binaries
54+
- name: Update formula
5555
run: |
56+
set -euo pipefail
5657
VERSION=${GITHUB_REF_NAME#v}
57-
curl -sL "https://github.com/apolloio/apollo-io-cli/releases/download/${GITHUB_REF_NAME}/apollo-macos-arm64" -o apollo-macos-arm64
58-
curl -sL "https://github.com/apolloio/apollo-io-cli/releases/download/${GITHUB_REF_NAME}/apollo-macos-x64" -o apollo-macos-x64
58+
BASE="https://github.com/apolloio/apollo-io-cli/releases/download/${GITHUB_REF_NAME}"
59+
for bin in apollo-macos-arm64 apollo-macos-x64 apollo-linux-x64; do
60+
curl -fsSL "${BASE}/${bin}" -o "${bin}"
61+
done
5962
ARM64_SHA=$(shasum -a 256 apollo-macos-arm64 | awk '{print $1}')
6063
X64_SHA=$(shasum -a 256 apollo-macos-x64 | awk '{print $1}')
64+
LINUX_X64_SHA=$(shasum -a 256 apollo-linux-x64 | awk '{print $1}')
6165
sed -i "s/version \".*\"/version \"${VERSION}\"/" Formula/apollo-io-cli.rb
6266
sed -i "/apollo-macos-arm64/{n;s/sha256 \".*\"/sha256 \"${ARM64_SHA}\"/}" Formula/apollo-io-cli.rb
6367
sed -i "/apollo-macos-x64/{n;s/sha256 \".*\"/sha256 \"${X64_SHA}\"/}" Formula/apollo-io-cli.rb
68+
sed -i "/apollo-linux-x64/{n;s/sha256 \".*\"/sha256 \"${LINUX_X64_SHA}\"/}" Formula/apollo-io-cli.rb
6469
65-
- name: Commit and push updated formula
66-
run: |
67-
git config user.name "github-actions[bot]"
68-
git config user.email "github-actions[bot]@users.noreply.github.com"
69-
git add Formula/apollo-io-cli.rb
70-
git commit -m "Update apollo-io-cli to ${GITHUB_REF_NAME}"
71-
git push
70+
- name: Open pull request on tap repo
71+
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6
72+
with:
73+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
74+
branch: bot/update-${{ github.ref_name }}
75+
commit-message: "Update apollo-io-cli to ${{ github.ref_name }}"
76+
title: "Update apollo-io-cli to ${{ github.ref_name }}"
77+
body: |
78+
Automated formula bump triggered by release ${{ github.ref_name }}.
79+
80+
Updates version and sha256 for all three release assets:
81+
- `apollo-macos-arm64`
82+
- `apollo-macos-x64`
83+
- `apollo-linux-x64`

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,21 @@ A command-line interface for the [Apollo.io API](https://apolloio.github.io/apol
66

77
## Installation
88

9+
### Homebrew (macOS / Linux)
10+
11+
```bash
12+
brew install apolloio/apollo-io-cli/apollo-io-cli
13+
```
14+
15+
Or tap once then install by short name:
16+
17+
```bash
18+
brew tap apolloio/apollo-io-cli
19+
brew install apollo-io-cli
20+
```
21+
22+
Upgrade with `brew upgrade apollo-io-cli`.
23+
924
### Download a prebuilt binary (no Node required)
1025

1126
Download the latest binary for your platform from the [releases page](https://github.com/apolloio/apollo-io-cli/releases):

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apollo-io-cli",
3-
"version": "0.2.0",
3+
"version": "0.5.1",
44
"description": "CLI for the Apollo.io API",
55
"type": "module",
66
"bin": {

src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env node
22

33
import { Command } from 'commander';
4+
import pkg from '../package.json' with { type: 'json' };
45
import { registerAuth } from './commands/auth.js';
56
import { registerPeople } from './commands/people.js';
67
import { registerCompanies } from './commands/companies.js';
@@ -21,7 +22,7 @@ const program = new Command();
2122
program
2223
.name('apollo')
2324
.description('CLI for the Apollo.io API')
24-
.version('0.1.0');
25+
.version(pkg.version);
2526

2627
registerAuth(program);
2728
registerPeople(program);

0 commit comments

Comments
 (0)