mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-11 13:38:41 +02:00
docs: improve hooks page
refs https://github.com/goreleaser/goreleaser/issues/2264
This commit is contained in:
parent
f1ccd8398e
commit
89d5692afe
@ -13,22 +13,23 @@ The configuration is very simple, here is a complete example:
|
||||
before:
|
||||
# Templates for the commands to be ran.
|
||||
hooks:
|
||||
- make clean # simple string
|
||||
- cmd: go generate ./... # specify cmd
|
||||
- cmd: go mod tidy
|
||||
dir: ./submodule # specify command working directory
|
||||
- cmd: touch {{ .Env.FILE_TO_TOUCH }}
|
||||
env:
|
||||
FILE_TO_TOUCH: 'something-{{ .ProjectName }}' # specify hook level environment variables
|
||||
- make clean
|
||||
- go generate ./...
|
||||
- go mod tidy
|
||||
- touch {{ .Env.FILE_TO_TOUCH }}
|
||||
```
|
||||
|
||||
If any of the hooks fails the build process is aborted.
|
||||
|
||||
In the same sense, you can also add global `after` hooks:
|
||||
## Pro Features
|
||||
|
||||
With [GoReleaser Pro](/pro), things are a bit more flexible: you can specify the dir, enviroment variables and also global after hooks.
|
||||
|
||||
```yaml
|
||||
# .goreleaser.yml
|
||||
after:
|
||||
|
||||
# global before hooks
|
||||
before:
|
||||
# Templates for the commands to be ran.
|
||||
hooks:
|
||||
- make clean # simple string
|
||||
@ -38,6 +39,17 @@ after:
|
||||
- cmd: touch {{ .Env.FILE_TO_TOUCH }}
|
||||
env:
|
||||
FILE_TO_TOUCH: 'something-{{ .ProjectName }}' # specify hook level environment variables
|
||||
|
||||
# global after hooks
|
||||
after:
|
||||
# Templates for the commands to be ran.
|
||||
hooks:
|
||||
- make clean
|
||||
- cmd: cat *.yaml
|
||||
dir: ./submodule
|
||||
- cmd: touch {{ .Env.RELEASE_DONE }}
|
||||
env:
|
||||
RELEASE_DONE: 'something-{{ .ProjectName }}' # specify hook level environment variables
|
||||
```
|
||||
|
||||
!!! info
|
||||
|
Loading…
x
Reference in New Issue
Block a user