github.com/goreleaser/goreleaser@v1.25.1/www/docs/customization/env.md (about)

     1  # Environment Variables
     2  
     3  Global environment variables to be passed down to all hooks and builds.
     4  
     5  If you have an environment variable named `FOOBAR` set to `on`, your
     6  `.goreleaser.yaml` file could use it like this:
     7  
     8  ```yaml
     9  # .goreleaser.yaml
    10  env:
    11    - FOO={{ .Env.FOOBAR }}
    12    - ENV_WITH_DEFAULT={{ if index .Env "ENV_WITH_DEFAULT"  }}{{ .Env.ENV_WITH_DEFAULT }}{{ else }}default_value{{ end }}
    13  before:
    14    hooks:
    15      - go mod tidy
    16  builds:
    17  - binary: program
    18  ```
    19  
    20  This way, both your before hooks (in this example, `go mod tidy`) and the
    21  underlying builds (using `go build`) will have `FOO` set to `on`.
    22  
    23  The root `env` section also accepts templates.
    24  
    25  !!! tip
    26      Learn more about the [name template engine](/customization/templates/).