Skip to content

Keep the Homebrew cask intact when its layout changes - #752

Merged
hannesa2 merged 1 commit into
masterfrom
release-update-homebrew-cask-by-value
Oct 5, 2026
Merged

hannesa2 merged 1 commit into
masterfrom
release-update-homebrew-cask-by-value

Conversation

@goneng

@goneng goneng commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

Make the release's Homebrew update survive changes Homebrew makes to the cask, and fail visibly when it cannot. This is the alternative to #747: the release job keeps opening its own bump PR, so the result is still immediate and the notifications still reach the PR's author, but the cask is no longer rebuilt by line number.

The step kept lines 1-3 and 7-33 of Casks/g/gitx.rb around a freshly written version and checksums. With one line added near the top (Homebrew last changed this cask in April, adding depends_on macos), it writes the intel: checksum line twice, which Ruby rejects as a syntax error, and the job still opens the pull request with it.

Changes

  • Move the update into scripts/update-homebrew-cask.sh: it replaces only the version and the two checksums, wherever they sit in the file, and leaves everything else exactly as Homebrew keeps it. Being a script, it runs the same locally as in the release job.
  • Fail the release job, leaving the cask alone, when those three values are not each found exactly once (for instance if Homebrew moves the checksums into on_arm/on_intel blocks), instead of sending a broken cask. A failed run notifies whoever pushed the tag.
  • Keep the rest as is: the checkout of homebrew-cask, the PR template step and the PR itself are unchanged.

Test plan

Ran the old step and the script on today's cask (from Homebrew/homebrew-cask) with the 1.6 disk images, and on variants of it:

  • Today's cask, same release: both leave it unchanged.
  • One line added near the top: the old step writes a cask that fails ruby -c; the script changes exactly the three lines.
  • A new release (1.7, other images): the script changes exactly the three values, and the result passes ruby -c and brew style.
  • Both checksums on one line: updated in place.
  • Checksums moved into on_arm/on_intel blocks, or the intel: line doubled: the script fails with a message and leaves the cask unchanged.

Make the release's Homebrew update survive changes Homebrew makes to the
cask, and fail visibly when it cannot: the step rebuilt gitx.rb by line
number, so one line added near its top produces a cask Ruby rejects,
and the job would still open the pull request with it.

- Move the update into scripts/update-homebrew-cask.sh, which replaces
  only the version and the two checksums, wherever they sit
- Fail the release job, leaving the cask alone, when those values are
  not each found exactly once, instead of sending a broken cask
- Keep the rest of the step order, the PR template and the PR as is
@hannesa2

hannesa2 commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

I see a new behavior in brew, I got the first notification with Homebrew/homebrew-cask#291706 (comment), then brew creates a new one Homebrew/homebrew-cask#291707.

Only with the first one (made by us) I receive a notification. Without the first one, I'll complete out of notification

@hannesa2
hannesa2 marked this pull request as ready for review October 5, 2026 05:31
@hannesa2

hannesa2 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

As brew inform us on issues Homebrew/homebrew-cask#291707 (comment) I give it a try

@hannesa2
hannesa2 merged commit 2bb523c into master Oct 5, 2026
3 checks passed
@hannesa2
hannesa2 deleted the release-update-homebrew-cask-by-value branch October 5, 2026 05:32
@hannesa2 hannesa2 added the pipeline CI pipeline label Oct 5, 2026
@hannesa2

hannesa2 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Ahh my bad. I merged this one, but my intention was to merge that Leave the Homebrew cask bump to Homebrew's autobump

@goneng

goneng commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Ahh my bad. I merged this one, but my intention was to merge that Leave the Homebrew cask bump to Homebrew's autobump

Well, this is a step in the right direction, and I've closed the one you are talking about so will not be merged by mistake...

Will revive that PR and confirm it doesn't collide with the current 'master'.

@goneng

goneng commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Will revive that PR and confirm it doesn't collide with the current 'master'.

PR is revived - see PR #747

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pipeline CI pipeline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants