feat: Homebrew distribution — tap auto-update + Node-compatible npm bundle#20
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
Disabled knowledge base sources:
📝 WalkthroughWalkthroughThe PR refactors the release-binaries workflow to run on Release workflow completion or manual dispatch, resolves tags dynamically, builds and uploads platform binaries + .sha256 to GitHub Releases, updates the Homebrew formula, adds README Homebrew install docs, and migrates runtime/fs usage from Bun to Node. ChangesRelease Workflow and Homebrew Integration
Sequence Diagram(s)sequenceDiagram
participant ReleaseWorkflow as Release Workflow
participant ReleaseBinaries as release-binaries workflow
participant BuildJob as build job
participant GitHubRelease as GitHub Release
participant UpdateTap as update-tap job
participant HomebrewTap as photon-hq/homebrew-photon
ReleaseWorkflow->>ReleaseBinaries: workflow_run (completed)
ReleaseBinaries->>BuildJob: resolve tag (gh or input) & checkout
BuildJob->>BuildJob: build binaries + generate .sha256
BuildJob->>GitHubRelease: gh release upload --clobber (binaries + .sha256)
ReleaseBinaries->>UpdateTap: resolve tag (gh or input)
UpdateTap->>GitHubRelease: download .sha256 assets
UpdateTap->>UpdateTap: extract version & checksums, generate Formula/photon.rb
UpdateTap->>HomebrewTap: commit & push Formula/photon.rb
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
- Switch release-binaries trigger from `release: created` (never fires with GITHUB_TOKEN) to `workflow_run` on Release completion - Add `update-tap` job that auto-pushes formula to photon-hq/homebrew-photon after binaries are uploaded - Checkout pinned to release tag for reproducible builds - Add Homebrew as first install option in README Requires `TAP_GITHUB_TOKEN` secret with push access to homebrew-photon. Co-authored-by: Cursor <cursoragent@cursor.com>
ac170e9 to
073ab7e
Compare
There was a problem hiding this comment.
Pull request overview
Adds automated Homebrew tap updates as part of the release pipeline, and documents Homebrew as a first-class install option for the Photon CLI.
Changes:
- Switch release-binaries workflow trigger from
release: createdtoworkflow_runon theReleaseworkflow completion, with a manualworkflow_dispatchfallback. - Upload compiled binaries +
.sha256assets to the GitHub Release, then generate and push an updatedFormula/photon.rbtophoton-hq/homebrew-tap. - Update README install instructions to include
brew install photon-hq/tap/photon.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Adds Homebrew installation instructions and renumbers install options. |
| .github/workflows/release-binaries.yaml | Reworks release asset build/upload trigger and adds an update-tap job to regenerate/push the Homebrew formula. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/release-binaries.yaml:
- Around line 57-58: The workflow currently resolves TAG by calling `gh release
view` without a tag, which returns the latest release; change the `TAG=$(gh
release view ...)` invocation to resolve the release by the triggering run's
commit using `github.event.workflow_run.head_sha` (i.e., pass the head SHA to
`gh release view --commitish` or otherwise query the release by that SHA) so the
`TAG` variable points to the exact release for the triggering workflow; apply
this same change in both places where `TAG=$(gh release view --repo "${{
github.repository }}" --json tagName -q .tagName)` appears so uploads and
checksum generation use the correct release.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 139d7395-7025-458b-a699-d21702cd680a
📒 Files selected for processing (2)
.github/workflows/release-binaries.yamlREADME.md
📜 Review details
🔇 Additional comments (2)
.github/workflows/release-binaries.yaml (1)
44-46: Good guard on workflow_run conclusion.The conditional gate correctly prevents execution when the upstream
Releaseworkflow did not succeed.README.md (1)
16-24: Homebrew install section is clear and user-friendly.Good placement as option 1, and the upgrade behavior note is concise and helpful.
Replace all Bun-specific APIs with Node.js equivalents so the npm bundle (`dist/photon.js`) runs on Node >= 18 without requiring Bun: - credentials.ts: Bun.file/Bun.write -> readFile/writeFile - avatar.ts: Bun.file -> stat + readFile + MIME map - api.ts: guard fetch.preconnect (Bun-only) with runtime check - index.ts: shebang #!/usr/bin/env bun -> node - package.json: build target bun -> node, add engines.node - tsconfig.json: add node types alongside bun Compiled binaries (release-binaries.yaml) still embed Bun via --compile --target bun-*. Only the npm-distributed JS bundle changes. Co-authored-by: Cursor <cursoragent@cursor.com>
Address bot review feedback on #20: - Use github.event.workflow_run.head_sha to find the exact release instead of gh release view (which returns latest and can race) - Replace hardcoded --repo photon-hq/cli with ${{ github.repository }} - Fail explicitly when no release matches the triggering commit Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 9 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
package.json:53
@types/nodeis pinned to v25.x whileengines.nodeis>=18. Using typings for a newer Node major can let unsupported APIs slip into the codebase and break the Node 18 runtime target. Prefer pinning@types/nodeto the minimum supported major (e.g.^18.xor^20.x) to keep typechecking aligned with the promised runtime compatibility.
"engines": {
"bun": ">=1.3.0",
"node": ">=18.0.0"
},
"scripts": {
"start": "bun run src/index.ts",
"dev": "bun run --watch src/index.ts",
"build": "bun build ./src/index.ts --outfile dist/photon.js --target node --minify && chmod +x dist/photon.js",
"compile": "bun build ./src/index.ts --compile --outfile dist/photon",
"typecheck": "tsc --noEmit",
"sync:api": "bun run scripts/sync-api-types.ts",
"prepublishOnly": "bun run typecheck && bun run build"
},
"devDependencies": {
"@types/bun": "latest",
"@types/node": "^25.6.2",
"@types/update-notifier": "^6.0.8",
"elysia": "1.4.28",
"typescript": "^5"
},
| const stats = await stat(file).catch(() => null); | ||
| if (!stats) { | ||
| die(`File not found: ${file}`); |
| const stats = await stat(file).catch(() => null); | ||
| if (!stats) { | ||
| die(`File not found: ${file}`); | ||
| } |
| else | ||
| SHA="${{ github.event.workflow_run.head_sha }}" | ||
| TAG=$(gh api "repos/${{ github.repository }}/releases" --paginate \ | ||
| --jq ".[] | select(.target_commitish == \"$SHA\") | .tag_name" | head -n1) | ||
| if [ -z "$TAG" ]; then | ||
| echo "::error::No release found for commit $SHA" | ||
| exit 1 | ||
| fi |
| else | ||
| echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" | ||
| SHA="${{ github.event.workflow_run.head_sha }}" | ||
| TAG=$(gh api "repos/${{ github.repository }}/releases" --paginate \ | ||
| --jq ".[] | select(.target_commitish == \"$SHA\") | .tag_name" | head -n1) | ||
| if [ -z "$TAG" ]; then | ||
| echo "::error::No release found for commit $SHA" | ||
| exit 1 | ||
| fi |
Summary
dist/photon.jsnow runs on Node >= 18 — enabling Homebrew formulas withdepends_on "node"+std_npm_args(same pattern as vercel-cli, firebase-cli, wrangler).release: creatednever fires when the release is made withGITHUB_TOKEN— switched toworkflow_runon Release completion so binaries build automatically on every release.update-tapjob runs after all binaries upload, generatesFormula/photon.rbwith fresh SHA256s, and pushes tophoton-hq/homebrew-photon.brew install photon-hq/photon/photonas the first install option.Compiled binaries (
--compile --target bun-*) are unaffected — they still embed Bun runtime.Setup required after merge
TAP_GITHUB_TOKENsecret — add a PAT withcontents: writeonphoton-hq/homebrew-photonto this repo's Actions secretsphoton.rbtophoton-hq/homebrew-photon/Formula/Verification
bun run typecheck— passesbun run build— producesdist/photon.jswith--target nodenode dist/photon.js --version— 0.1.5node dist/photon.js ping— 200 OKbun run src/index.ts --version— dev mode still worksbun run compile— standalone binary still buildsgrep -r 'Bun\.' src/— zero matchesInstall after merge
Summary by CodeRabbit
New Features
Chores