Global Hooks
Run shell commands before or after the release pipeline
Hooks let you run arbitrary shell commands at the start or end of the release pipeline.
Minimal config
before:
hooks:
- "echo 'Starting release'"
- "cargo fmt --check"
after:
hooks:
- "echo 'Release complete'"
- "./scripts/notify.sh"Behavior
beforehooks run before any pipeline stage executesafterhooks run after all pipeline stages complete successfullybefore_publishhooks run after build / archive / sign / sbom / checksum complete but before any publisher dispatches — see Before-Publish Hooks for the full reference- Each hook is executed via
sh -c "<command>" - If any
beforeorbefore_publishhook fails (non-zero exit), the pipeline aborts before any subsequent stage runs - Hooks are skipped in
--dry-runmode (logged but not executed) - Environment variables from the
envconfig section are available to hooks
Back-compat alias: post:
Older anodizer configs use after.post: instead of after.hooks:. The
old spelling is still accepted (folded into hooks: at parse time with
a deprecation warning) so existing configs keep working, but new
configs should match GoReleaser Pro and use hooks: for both before:
and after: blocks.
Use cases
- Pre-flight checks:
cargo fmt --check,cargo clippy - Post-release notifications: Slack webhooks, deployment triggers
- Artifact post-processing: signing, uploading to additional locations