From 89d5692afe37be69374943b6d3540358727cddaf Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 27 May 2021 14:46:59 -0300 Subject: [PATCH] docs: improve hooks page refs https://github.com/goreleaser/goreleaser/issues/2264 --- www/docs/customization/hooks.md | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/www/docs/customization/hooks.md b/www/docs/customization/hooks.md index 63178df52..1fbcbc1ed 100644 --- a/www/docs/customization/hooks.md +++ b/www/docs/customization/hooks.md @@ -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