1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-09 13:36:56 +02:00

27 lines
698 B
Markdown
Raw Normal View History

2021-10-30 09:50:23 -03:00
# Environment Variables
Global environment variables to be passed down to all hooks and builds.
This is useful for `GO111MODULE`, for example. You can have your `.goreleaser.yml` file like the following:
```yaml
# .goreleaser.yml
env:
- GO111MODULE=on
- FOO={{ .Env.FOOBAR }}
- ENV_WITH_DEFAULT={{ if index .Env "ENV_WITH_DEFAULT" }}{{ .Env.ENV_WITH_DEFAULT }}{{ else }}default_value{{ end }}
before:
hooks:
- go mod tidy
builds:
- binary: program
```
This way, both `go mod tidy` and the underlying `go build` will have
`GO111MODULE` set to `on`.
2021-05-24 23:23:59 -03:00
The root `env` section also accepts templates.
!!! tip
Learn more about the [name template engine](/customization/templates/).