fix(casks): binary packages need to rename to binary#5840
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for naming and targeting binary packages in Homebrew Cask outputs by extending the data model, rendering logic, and templates accordingly.
- Extend
templateDataandreleasePackagewithHasOnlyBinaryPkgs,Name, andBinaryto capture binary package metadata. - Update
cask.goto populate and count binary artifacts, and set theHasOnlyBinaryPkgsflag. - Modify Ruby templates to conditionally emit
binary "<name>", target: "<binary>"and adjust the default cask template to skip binary-only cases. - Refresh testdata golden files to reflect the new
binary …, target: …stanzas.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/pipe/cask/testdata/TestRunPipePullRequest.rb.golden | Add binary "foo_macos", target: "foo" in pull-request scenario |
| internal/pipe/cask/testdata/TestRunPipeBinaryRelease.rb.golden | Remove generic binary "foo" and include targeted binary entry |
| internal/pipe/cask/templates/macos_packages.rb | Insert conditional binary "{{ .Name }}", target: "{{ .Binary }}" for macOS packages |
| internal/pipe/cask/templates/linux_packages.rb | Insert conditional binary "{{ .Name }}", target: "{{ .Binary }}" for Linux packages |
| internal/pipe/cask/templates/cask.rb | Update default cask template to {{ with and (not .HasOnlyBinaryPkgs) .Binary }} |
| internal/pipe/cask/template.go | Add HasOnlyBinaryPkgs to templateData; add Name & Binary to releasePackage |
| internal/pipe/cask/cask.go | Populate pkg.Name/pkg.Binary, track formatCounts, and set HasOnlyBinaryPkgs |
Comments suppressed due to low confidence (3)
internal/pipe/cask/cask.go:364
- [nitpick] The variable
formatCountsis ambiguous. Consider renaming it toartifactTypeCountsortypeCountsfor clearer intent.
formatCounts := map[artifact.Type]int{}
internal/pipe/cask/template.go:20
- [nitpick] Please add doc comments for the new
HasOnlyBinaryPkgs,Name, andBinaryfields intemplateDataandreleasePackageto clarify their purpose and usage.
HasOnlyBinaryPkgs bool
internal/pipe/cask/templates/cask.rb:11
- The template references
.Binaryat the top level, buttemplateDatahas noBinaryfield. Either add a top-levelBinaryproperty totemplateDataor adjust this block to use the correct context.
{{ with and (not .HasOnlyBinaryPkgs) .Binary }}
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5840 +/- ##
=======================================
Coverage 82.66% 82.66%
=======================================
Files 164 164
Lines 16445 16451 +6
=======================================
+ Hits 13594 13600 +6
Misses 2258 2258
Partials 593 593 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
SMillerDev
approved these changes
Jun 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
this should fix the issue reported by @dorianm at https://github.com/orgs/goreleaser/discussions/5563#discussioncomment-13497346