Skip to content

fix(release): wrap before.hooks in sh -c (export builtin + YAML-quote URL colons)#58

Merged
intel352 merged 2 commits intomainfrom
fix/goreleaser-export-builtin
May 3, 2026
Merged

fix(release): wrap before.hooks in sh -c (export builtin + YAML-quote URL colons)#58
intel352 merged 2 commits intomainfrom
fix/goreleaser-export-builtin

Conversation

@intel352
Copy link
Copy Markdown
Contributor

@intel352 intel352 commented May 3, 2026

Summary

After PR #57 unblocked the v0.9.0 release from the top-level after: issue, goreleaser run #2 (id 25274980854) failed with:

exec: "export": executable file not found in $PATH

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 two sed hooks above only worked accidentally — goreleaser passed everything past the first whitespace as positional args to sed, which silently absorbed && and rm as positional args (the mutations to plugin.json may not have been happening as intended).

Fix

Wrap all three before.hooks in sh -c "<...>". Also YAML-quote the outer string so the embedded : inside URLs (github.com:.../...) doesn't get parsed as YAML mapping syntax.

Verification

goreleaser/goreleaser:v2.15.4 check
  • DEPRECATED: archives.builds (advisory)
  • configuration is valid, but uses deprecated properties

(The deprecation is non-blocking + pre-existing.)

After merge

The v0.9.0 tag will be force-moved again to the new fix-included commit so goreleaser re-runs.

🤖 Generated with Claude Code

intel352 and others added 2 commits May 3, 2026 05:05
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>
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`.
Copilot AI review requested due to automatic review settings May 3, 2026 09:07
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

Updates the repository’s GoReleaser v2 configuration so the before.hooks steps reliably execute as intended (including shell builtins/operators), preventing release workflow failures during v0.9.0 publishing.

Changes:

  • Wrap all before.hooks commands in sh -c so export, &&, and $(...) are executed by a shell rather than being shlex-split into argv.
  • Add explanatory comments documenting the GoReleaser v2 hook execution behavior and why the wrapping is required.

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

@intel352 intel352 merged commit 45dd6a3 into main May 3, 2026
8 checks passed
@intel352 intel352 deleted the fix/goreleaser-export-builtin branch May 3, 2026 09:09
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