Skip to content

feat(release): add homebrew cask - #794

Merged
skevetter merged 3 commits into
mainfrom
fix/homebrew-publish-diff-check
Jul 28, 2026
Merged

feat(release): add homebrew cask#794
skevetter merged 3 commits into
mainfrom
fix/homebrew-publish-diff-check

Conversation

@skevetter

@skevetter skevetter commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Two related changes to the Homebrew publish step.

Fix: new-file detection

The publish step ran git diff --quiet before git add, so a new untracked Formula/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 checks git diff --cached --quiet, and pushes with -u origin HEAD so the first push on a fresh repo sets upstream.

Feature: desktop app cask

brew install devsy-org/tap/devsy only installed the CLI. Homebrew distributes GUI apps as casks, not formulae. This adds a cask generator (hack/homebrew_cask) that emits Casks/devsy.rb from 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:

brew install --cask devsy-org/tap/devsy

Summary by CodeRabbit

  • New Features

    • Added Homebrew cask publishing alongside the existing formula.
    • macOS release DMG assets are now used to generate cask entries with architecture-specific checksums.
    • Homebrew publishing now updates both formula and cask definitions automatically.
  • Bug Fixes

    • Prevented publishing when neither Homebrew definition has changed.
    • Added validation for missing macOS release assets during cask generation.
  • Tests

    • Added coverage for cask rendering, version handling, architecture mapping, checksums, and missing assets.

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.
@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 04c5e90
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a68c93ac24c710008160053

@netlify

netlify Bot commented Jul 28, 2026

Copy link
Copy Markdown

Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 04c5e90
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a68c93a4ef4f300086034bc

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@skevetter, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 48 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b964000-b044-4627-bcf6-606a68f99fc4

📥 Commits

Reviewing files that changed from the base of the PR and between cfa5cfd and 04c5e90.

📒 Files selected for processing (1)
  • hack/homebrew_cask/main_test.go
📝 Walkthrough

Walkthrough

The 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.

Changes

Homebrew formula and cask publication

Layer / File(s) Summary
Generate cask from macOS artifacts
.github/workflows/release.yml, hack/homebrew_cask/main.go, hack/homebrew_cask/main_test.go
macOS DMGs are transferred to the publishing job; the generator hashes architecture-specific files and renders a versioned cask, with tests covering output and missing assets.
Stage and publish formula and cask
.github/workflows/release.yml
The workflow stages Formula/devsy.rb and Casks/devsy.rb, skips publishing when the cached diff is empty, and pushes committed changes with an explicitly configured upstream branch.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • devsy-org/devsy#326: Updates the release workflow’s macOS DMG artifact flow used by this cask publication.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: adding Homebrew cask support to the release workflow.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@skevetter
skevetter marked this pull request as draft July 28, 2026 04:58
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
@skevetter skevetter changed the title fix(release): detect new formula file when publishing homebrew tap fix(release): homebrew publish — detect new formula + add desktop cask Jul 28, 2026
@github-actions github-actions Bot added size/l and removed size/xs labels Jul 28, 2026
@skevetter skevetter changed the title fix(release): homebrew publish — detect new formula + add desktop cask feat(release): add homebrew cask Jul 28, 2026
@skevetter
skevetter marked this pull request as ready for review July 28, 2026 15:10

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
hack/homebrew_cask/main_test.go (1)

28-42: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover the Intel checksum path.

TestRender asserts 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

📥 Commits

Reviewing files that changed from the base of the PR and between b8ff3fe and cfa5cfd.

📒 Files selected for processing (3)
  • .github/workflows/release.yml
  • hack/homebrew_cask/main.go
  • hack/homebrew_cask/main_test.go

Comment on lines +449 to +453
go run ./hack/homebrew_cask \
--dmg-dir "$DMG_DIR" \
--repo "$REPO" \
--tag "$TAG" \
--out tap/Casks/devsy.rb

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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"' sh

Repository: 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"' sh

Repository: 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:


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.

@skevetter
skevetter merged commit f2f3c70 into main Jul 28, 2026
66 checks passed
@skevetter
skevetter deleted the fix/homebrew-publish-diff-check branch July 28, 2026 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant