feat(release): add homebrew cask - #794
Conversation
Stage the formula before checking for changes so a new (untracked) file is detected, not just modifications to a tracked one. Use git diff --cached and push with -u origin HEAD so a fresh/empty tap repo publishes correctly.
✅ Deploy Preview for images-devsy-sh canceled.
|
✅ Deploy Preview for devsydev canceled.
|
|
Warning Review limit reached
Next review available in: 48 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe release workflow now uploads macOS DMGs, generates both Homebrew formula and cask files, validates cask rendering and checksums, and publishes both files only when staged changes exist. ChangesHomebrew formula and cask publication
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add a cask generator (hack/homebrew_cask) that emits Casks/devsy.rb from the notarized macOS dmgs, and wire it into the publish-homebrew job: upload the mac dmgs as a workflow artifact, download them alongside the CLI binaries, and generate + commit the cask next to the formula. Users can install the desktop app with: brew install --cask devsy-org/tap/devsy
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
hack/homebrew_cask/main_test.go (1)
28-42: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover the Intel checksum path.
TestRenderasserts only the ARM digest. Add an assertion for the Intel fixture digest so an Intel-only checksum/rendering regression cannot publish a broken cask.🤖 Prompt for 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. In `@hack/homebrew_cask/main_test.go` around lines 28 - 42, The TestRender assertions currently validate only the ARM checksum. Add the expected SHA-256 digest for the Intel fixture and assert that the rendered output contains the corresponding Intel checksum entry, alongside the existing wantARM assertion.
🤖 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.yml:
- Around line 449-453: Align the macOS DMG naming between the electron-builder
artifactName configuration and the homebrew_cask consumer: ensure generated
files use the Cask contract names Devsy_mac_arm64.dmg and Devsy_mac_x64.dmg
instead of Darwin-prefixed names. Update the relevant naming logic in the
release workflow or the hack/homebrew_cask lookup while preserving Linux and
other artifact naming.
---
Nitpick comments:
In `@hack/homebrew_cask/main_test.go`:
- Around line 28-42: The TestRender assertions currently validate only the ARM
checksum. Add the expected SHA-256 digest for the Intel fixture and assert that
the rendered output contains the corresponding Intel checksum entry, alongside
the existing wantARM assertion.
🪄 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 Plus
Run ID: 31c501d9-6b46-40d7-869f-9fff216277da
📒 Files selected for processing (3)
.github/workflows/release.ymlhack/homebrew_cask/main.gohack/homebrew_cask/main_test.go
| go run ./hack/homebrew_cask \ | ||
| --dmg-dir "$DMG_DIR" \ | ||
| --repo "$REPO" \ | ||
| --tag "$TAG" \ | ||
| --out tap/Casks/devsy.rb |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
fd -a '^electron-builder\.(yml|yaml)$' desktop \
-x sh -c 'echo "--- $1"; rg -n -C4 "artifactName|dmg|Devsy_mac_(arm64|x64)" "$1"' shRepository: devsy-org/devsy
Length of output: 1139
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "--- workflow relevant snippets"
sed -n '1,90p' .github/workflows/release.yml
sed -n '400,470p' .github/workflows/release.yml
echo "--- all references to homebrew_cask and dmg file filters"
rg -n "homebrew_cask|Devsy_mac_(arm64|x64)|\\.dmg|artifactName|os: mac|arch:" .github/workflows/release.yml desktop/electron-builder.yml
echo "--- deterministic artifactName expansion for the two mac arch values used by electron-builder env vars"
python3 - <<'PY'
for os in ("Darwin",):
for arch in ("arm64", "x64"):
ext = "dmg"
print("mac", os, arch, f"Devsy_{os}_{arch}.{ext}")
PY
echo "--- check available electron-builder package docs/docs snippets in repo"
fd -a '^README|CHANGELOG|HISTORY|package.json|pnpm-lock.yaml|yarn.lock|package-lock.json$' desktop -x sh -c 'echo "--- $1"; sed -n "1,220p" "$1"' shRepository: devsy-org/devsy
Length of output: 16906
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "--- homebrew cask implementation"
fd -a 'homebrew_cask\.(go|ts|js)$' . -x sh -c 'echo "--- $1"; cat -n "$1"' sh
echo "--- release dmg upload/download and filename handling"
sed -n '190,245p' .github/workflows/release.yml
rg -n -C3 "dmgDir|Devsy_mac|*.dmg|listDir|files|artifacts|Cask|dmg" . -g '!node_modules' -g '!*.lock'Repository: devsy-org/devsy
Length of output: 2775
🌐 Web query:
electron-builder 26.15.3 mac artifactName arch variables mac-arm64 release directory
💡 Result:
To configure the artifact file name for macOS builds in electron-builder, you can use the artifactName property within your configuration [1][2]. To include the architecture (such as arm64 or x64) in the file name, use the ${arch} variable in your template [3][4][5]. Configuration Example: { "mac": { "artifactName": "${productName}-${version}-${arch}.${ext}" } } Key Details: 1. Supported Variables: You can use several macros in the artifactName template, including ${arch}, ${productName}, ${version}, ${ext}, and environment variables like ${env.VAR_NAME} [4][5]. 2. Arch Variable Behavior: When using ${arch}, if no architecture is specified for the build, electron-builder may remove the macro and any leading separators (like hyphens or underscores) to avoid double punctuation [4]. If you are building both x64 and arm64, including ${arch} is necessary to prevent files from overwriting each other [6][3]. 3. Target Considerations: While standard for DMG and ZIP targets, some specific targets like pkg have historically required explicit macro handling to ensure the arch correctly reflects in the filename [6]. 4. Release Directory: By default, artifacts are placed in the dist/ directory of your project root, unless otherwise configured via the outDir property. If you encounter issues where the architecture is not being reflected in the filename, ensure you are using a recent version of electron-builder, as earlier versions had limitations regarding dynamic expansion for specific targets like pkg [6][7].
Citations:
- 1: https://www.electron.build/electron-builder.interface.macconfiguration
- 2: https://www.electron.build/docs/configuration/
- 3: How to update artifactName without breaking autoupdate? electron-userland/electron-builder#8758
- 4: https://stackoverflow.com/questions/40549421/retrieve-or-specify-output-file-name-in-electron-builder
- 5: https://github.com/pedronauck/skills/blob/main/skills/electron-builder/SKILL.md
- 6: macOS pkg written to same filename for x64 and arm64 electron-userland/electron-builder#5847
- 7: artifactName for "arm64" not working electron-userland/electron-builder#5569
Make the generated DMG names match the Cask contract.
The macOS matrix uses electron-builder’s arch values, so artifactName: Devsy_${os}_${arch}.${ext} can emit Devsy_Darwin_arm64.dmg / Devsy_Darwin_x64.dmg, but the cask consumer expects Devsy_mac_arm64.dmg / Devsy_mac_x64.dmg. Align the filename used by electron-builder or update hack/homebrew_cask so publishing does not fail after builds complete.
🤖 Prompt for 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.
In @.github/workflows/release.yml around lines 449 - 453, Align the macOS DMG
naming between the electron-builder artifactName configuration and the
homebrew_cask consumer: ensure generated files use the Cask contract names
Devsy_mac_arm64.dmg and Devsy_mac_x64.dmg instead of Darwin-prefixed names.
Update the relevant naming logic in the release workflow or the
hack/homebrew_cask lookup while preserving Linux and other artifact naming.
Two related changes to the Homebrew publish step.
Fix: new-file detection
The publish step ran
git diff --quietbeforegit add, so a new untrackedFormula/devsy.rb(e.g. a fresh/empty tap repo) was never detected — the job reported "nothing to publish" and exited without committing. Now it stages first and checksgit diff --cached --quiet, and pushes with-u origin HEADso the first push on a fresh repo sets upstream.Feature: desktop app cask
brew install devsy-org/tap/devsyonly installed the CLI. Homebrew distributes GUI apps as casks, not formulae. This adds a cask generator (hack/homebrew_cask) that emitsCasks/devsy.rbfrom the notarized macOS dmgs, and wires it into the publish job (upload dmgs as a workflow artifact → download alongside the CLI binaries → generate + commit the cask next to the formula).Users can then install the desktop app with:
Summary by CodeRabbit
New Features
Bug Fixes
Tests