Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ binaries:

`repo`, `goreleaser_config`, `version_file`, and `tag` remain top-level. For a
multi-binary manifest, every GoReleaser build needs an `id`, and each archive,
nfpm, and Homebrew cask must use `ids` or `builds` to select builds belonging
to one binary. Multi-binary Chocolatey packages live under
and nfpm must use `ids` or `builds` to select builds belonging to one binary.
Each Homebrew cask must use `ids` to select archives belonging to one binary.
Multi-binary Chocolatey packages live under
`packaging/chocolatey/<id>/`; the single-binary flat layout is unchanged.

Call either reusable workflow with `manifest-path` and `working-directory`
Expand Down
16 changes: 15 additions & 1 deletion actions/identity-check/identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,27 @@ def validate(manifest_path: str, working_dir: str, repo_root: str = ".") -> list
else:
build_to_binary[dedupe_key] = build["binary"]

for kind in ("archives", "nfpms", "homebrew_casks"):
archive_to_binary: dict[str, str] = {}
for kind in ("archives", "nfpms"):
for entry in gor.get(kind, []) or []:
owner, error = _entry_owner(entry, build_to_binary, multi, kind)
if error:
errors.append(error)
elif owner in owned:
owned[owner][kind].append(entry)
if kind == "archives" and entry.get("id"):
archive_to_binary[entry["id"]] = owner

# GoReleaser casks consume archives, so their ids refer to archive ids,
# not build ids. Single-binary configs may omit filters and retain the
# historical build-map attribution fallback.
cask_owners = archive_to_binary if multi else build_to_binary
for entry in gor.get("homebrew_casks", []) or []:
owner, error = _entry_owner(entry, cask_owners, multi, "homebrew_casks")
if error:
errors.append(error)
elif owner in owned:
owned[owner]["homebrew_casks"].append(entry)

for name, binary in by_name.items():
pkgs = binary.get("packages", {}) or {}
Expand Down
2 changes: 1 addition & 1 deletion actions/identity-check/test_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def test_multi_binary_build_without_id_fails(tmp_path):

def test_multi_binary_archive_cannot_mix_builds(tmp_path):
wd = multi_fixture(tmp_path)
rewrite_yaml(wd / ".goreleaser.yml", lambda data: data["archives"][0].__setitem__("ids", ["gro", "grw"]))
rewrite_yaml(wd / ".goreleaser.yml", lambda data: data["archives"][0].__setitem__("ids", ["gro-darwin", "grw-darwin"]))
errors = identity.validate(str(wd / "packaging" / "identity.yml"), str(wd), str(wd))
assert any("archives entry mixes binaries" in error for error in errors)

Expand Down
18 changes: 10 additions & 8 deletions tests/fixtures/identity/google-cli/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
builds:
- {id: gro, binary: gro}
- {id: gro-darwin, binary: gro}
- {id: grw, binary: grw}
- {id: gro-unix-win, binary: gro}
- {id: grw-darwin, binary: grw}
- {id: grw-unix-win, binary: grw}
archives:
- ids: [gro, gro-darwin]
- id: gro
ids: [gro-darwin, gro-unix-win]
name_template: "gro_v{{ .Version }}_{{ .Os }}_{{ .Arch }}"
- ids: [grw, grw-darwin]
- id: grw
ids: [grw-darwin, grw-unix-win]
name_template: "grw_v{{ .Version }}_{{ .Os }}_{{ .Arch }}"
nfpms:
- ids: [gro]
- ids: [gro-unix-win]
package_name: google-readonly
- ids: [grw]
- ids: [grw-unix-win]
package_name: grw
homebrew_casks:
- ids: [gro-darwin]
- ids: [gro]
name: gro
- ids: [grw-darwin]
- ids: [grw]
name: grw
Loading