1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/www/docs/customization/hooks.md
Carlos Alexandro Becker 943ef1d81f
docs: improvements (#1501)
* docs: enable instant

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: minify html

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: edit uri

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: remove uneeded meta

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* docs: several improvements

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: broken links

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2020-05-10 18:59:21 -03:00

867 B

title
Global Hooks

Some builds may need pre-build steps before building, e.g. go generate. The before section allows for global hooks which will be executed before the build is started.

The configuration is very simple, here is a complete example:

# .goreleaser.yml
before:
  # Templates for the commands to be ran.
  hooks:
  - make clean
  - go generate ./...
  - go mod download
  - touch {{ .Env.FILE_TO_TOUCH }}

If any of the hooks fails the build process is aborted.

It is important to note that you can't have "complex" commands, like bash -c "echo foo bar" or foo | bar or anything like that. If you need to do things that are more complex than just calling a command with some attributes, wrap it in a shell script or into your Makefile.

!!! tip Learn more about the name template engine.