Skip to content

fix(release): remove top-level after: hook (unblocks goreleaser v2)#57

Merged
intel352 merged 1 commit intomainfrom
fix/goreleaser-after-hook
May 3, 2026
Merged

fix(release): remove top-level after: hook (unblocks goreleaser v2)#57
intel352 merged 1 commit intomainfrom
fix/goreleaser-after-hook

Conversation

@intel352
Copy link
Copy Markdown
Contributor

@intel352 intel352 commented May 3, 2026

Summary

PR #41 added a top-level after: hook to .goreleaser.yaml. goreleaser v2 has no top-level after: field — only before: exists. The v0.9.0 release workflow (run 25274816649) failed instantly with:

yaml: unmarshal errors: line 12: field after not found in type config.Project

Removed the after: block. The mv plugin.json.orig plugin.json it ran was theatre: the GH Actions runner is ephemeral, so the in-place sed mutations to plugin.json are discarded when the runner shuts down. There's nothing on the runner to restore. Also removed the matching cp plugin.json plugin.json.orig from before: — it was preserving state nothing else reads.

Verification

goreleaser/goreleaser:v2.15.4 check
  • checking                  path=.goreleaser.yaml
  • DEPRECATED: archives.builds should not be used anymore (advisory)
  • .goreleaser.yaml          error=configuration is valid, but uses deprecated properties

Config is valid (the deprecation is non-blocking + pre-existing).

After merge

The v0.9.0 tag will need to be force-moved to the new fix-included commit so the release workflow re-runs. The tag has existed for ~5 minutes with no successful release artifacts (the goreleaser failure is what we're fixing), so no consumers have pulled it.

Test plan

  • CI green
  • Force-move v0.9.0 tag → release workflow runs → artifacts uploaded

🤖 Generated with Claude Code

PR #41 added a top-level `after:` hook to .goreleaser.yaml. goreleaser
v2 has no top-level `after:` field — only `before:` exists. The release
workflow for v0.9.0 (run 25274816649) failed instantly with
`yaml: unmarshal errors: line 12: field after not found in type
config.Project`.

The previous `mv plugin.json.orig plugin.json` was theatre anyway: the
GH Actions runner is ephemeral, so the in-place sed mutations to
plugin.json are discarded when the runner shuts down. No need to
restore plugin.json on the runner. Removed the matching `cp
plugin.json plugin.json.orig` from the before block as well — it was
preserving state nothing else reads.

Validated with goreleaser/goreleaser:v2.15.4 check.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 3, 2026 09:00
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR unblocks the release pipeline by updating the GoReleaser configuration to be compatible with GoReleaser v2, removing an invalid top-level after: hook that caused release workflow failure.

Changes:

  • Removed the unsupported top-level after: hook from .goreleaser.yaml.
  • Removed the corresponding cp plugin.json plugin.json.orig step from before.hooks.
  • Added an explanatory comment documenting why the after: hook was removed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .goreleaser.yaml
Comment on lines +14 to +19
# config.Project`. The previous `mv plugin.json.orig plugin.json` was
# theatre — the GH Actions runner is ephemeral, so the in-place sed
# mutations to plugin.json are discarded the moment the runner shuts
# down. There is no need to restore plugin.json on the runner. Removed
# the matching `cp plugin.json plugin.json.orig` from the before block
# too — it was preserving state nothing else reads.
Comment thread .goreleaser.yaml
Comment on lines +12 to +19
# v2 has no top-level `after:` hook — it failed v0.9.0's release at
# `yaml: unmarshal errors: line 12: field after not found in type
# config.Project`. The previous `mv plugin.json.orig plugin.json` was
# theatre — the GH Actions runner is ephemeral, so the in-place sed
# mutations to plugin.json are discarded the moment the runner shuts
# down. There is no need to restore plugin.json on the runner. Removed
# the matching `cp plugin.json plugin.json.orig` from the before block
# too — it was preserving state nothing else reads.
@intel352 intel352 merged commit 4c48a63 into main May 3, 2026
8 checks passed
@intel352 intel352 deleted the fix/goreleaser-after-hook branch May 3, 2026 09:03
intel352 added a commit that referenced this pull request May 3, 2026
… URL colons) (#58)

* fix(release): wrap before.hooks in sh -c for shell builtins/operators

goreleaser v2 exec's each hook string via shlex.Split rather than
passing it to a shell, so shell builtins (export), operators (&&, ;),
and command substitution ($(...)) only work when wrapped in
`sh -c "<...>"`.

The wfctl strict-contracts hook used `export` and failed v0.9.0's
release-r2 (run 25274980854) with `exec: "export": executable file not
found in $PATH`. The two sed hooks above only worked accidentally:
goreleaser passed everything past the first whitespace as positional
args to `sed`, which silently absorbs `&&` and `rm` as positional args.
The mutations to plugin.json may not actually have been happening as
intended in releases — wrapping all three in `sh -c` makes the
behaviour match the apparent intent.

Pair with #57 — both unblock the v0.9.0 release pipeline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(release): YAML-quote sh -c hooks (URL colons confuse YAML mapping)

The prior commit's `sh -c "..."` form was a plain (non-quoted) YAML
scalar, so the embedded `:` inside URLs (e.g. https://...) was parsed
as YAML mapping syntax. yaml errored:
`mapping values are not allowed in this context`.

Wrap each hook in YAML double-quotes with proper backslash-escaping of
the inner shell double-quotes. Validated locally with
`goreleaser/goreleaser:v2.15.4 check`.

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants