1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-19 20:57:53 +02:00
Carlos Alexandro Becker 6b645926a8
docs: improve docs (#5006)
closes https://github.com/orgs/goreleaser/discussions/5004

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-07-17 10:56:36 -03:00

26 lines
673 B
Markdown

# Environment Variables
Global environment variables to be passed down to all hooks and builds.
If you have an environment variable named `FOOBAR` set to `on`, your
`.goreleaser.yaml` file could use it like this:
```yaml
# .goreleaser.yaml
env:
- 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 your before hooks (in this example, `go mod tidy`) and the
underlying builds (using `go build`) will have `FOO` set to `on`.
The root `env` section also accepts templates.
<!-- md:templates -->