github.com/joselitofilho/goreleaser@v0.155.1-0.20210123221854-e4891856c593/www/docs/customization/hooks.md (about)

     1  ---
     2  title: Global Hooks
     3  ---
     4  
     5  Some builds may need pre-build steps before building, e.g. `go generate`.
     6  The `before` section allows for global hooks which will be executed before
     7  the build is started.
     8  
     9  The configuration is very simple, here is a complete example:
    10  
    11  ```yaml
    12  # .goreleaser.yml
    13  before:
    14    # Templates for the commands to be ran.
    15    hooks:
    16    - make clean
    17    - go generate ./...
    18    - go mod download
    19    - touch {{ .Env.FILE_TO_TOUCH }}
    20  ```
    21  
    22  If any of the hooks fails the build process is aborted.
    23  
    24  It is important to note that you can't have "complex" commands, like
    25  `bash -c "echo foo bar"` or `foo | bar` or anything like that. If you need
    26  to do things that are more complex than just calling a command with some
    27  attributes, wrap it in a shell script or into your `Makefile`.
    28  
    29  !!! tip
    30      Learn more about the [name template engine](/customization/templates/).