Global Hooks
Some release cycles may need to run something before or after everything else.
GoReleaser allows this with the global hooks feature.
The before section allows for global hooks that will be executed
before the release is started.
The configuration is straightforward, here is an example with all possible options:
.goreleaser.yaml
before:
# Templates for the commands to be ran.
hooks:
- make clean
- go generate ./...
- go mod tidy
- touch {{ .Env.FILE_TO_TOUCH }}Note that if any of the hooks fails, the release process is aborted.
Complex commands
If you need to do anything more complex, create a shell script and call it
instead. You can also use sh -c "my commands", but that gets messy quickly.
Learn more about the template language.
Last updated on