1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-10 03:47:03 +02:00
goreleaser/www/docs/customization/env.md
Carlos A Becker d3bc4fe2c5
docs: better env docs
closes #1795

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
2021-05-31 01:53:57 +00:00

711 B

title
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:

# .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.

The root env section also accepts templates.

!!! tip Learn more about the name template engine.