From 5a199e50d28a786e92fd33654a542f4d9096eff4 Mon Sep 17 00:00:00 2001 From: Frank Schroeder Date: Thu, 7 Dec 2017 23:21:36 +0100 Subject: [PATCH] docs: add docs for env vars in name_template Add docs for using env vars in name_template. --- docs/060-archive.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/060-archive.md b/docs/060-archive.md index b53212d88..8f9d314be 100644 --- a/docs/060-archive.md +++ b/docs/060-archive.md @@ -20,6 +20,7 @@ archive: # - Os # - Arch # - Arm (ARM version) + # - Env (environment variables) # Default is `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}`. name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" @@ -63,3 +64,19 @@ archive: - docs/* - design/*.png ``` + +## Passing environment variables to name_template + +You can do that by using `{{ .Env.VARIABLE_NAME }}` in the template, for +example: + +```yaml +archive: + name_template: '{{.ProjectName}}-{{.Version}}-{{.Env.GOVERSION_NR}}' +``` + +Then you can run: + +```console +GOVERSION_NR=$(go version | awk '{print $3;}') goreleaser +```