1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-08 03:31:59 +02:00

feat: added Commit to docker name_template

This commit is contained in:
Carlos Alexandro Becker 2018-04-30 20:32:48 -07:00 committed by Carlos Alexandro Becker
parent 438e6e210a
commit ad118b0f7c
3 changed files with 17 additions and 6 deletions

View File

@ -53,9 +53,14 @@ dockers:
skip_push: false skip_push: false
# Path to the Dockerfile (from the project root). # Path to the Dockerfile (from the project root).
dockerfile: Dockerfile dockerfile: Dockerfile
# Template of the docker tag. Defaults to `{{ .Version }}`. Other allowed # Template of the docker tag. Defaults to `{{ .Version }}`.
# fields are `.Tag`, `.Major`, `.Minor` and `.Patch` and # Other allowed fields are:
# `.Env.VARIABLE_NAME`. # - `.Commint`
# - `.Tag`
# - `.Major`
# - `.Minor`
# - `.Patch`
# - `.Env.VARIABLE_NAME`
tag_templates: tag_templates:
- "{{ .Tag }}" - "{{ .Tag }}"
- "{{ .Tag }}-{{ .Env.GO_VERSION }}" - "{{ .Tag }}-{{ .Env.GO_VERSION }}"

View File

@ -126,11 +126,16 @@ func tagName(ctx *context.Context, tagTemplate string) (string, error) {
return "", err return "", err
} }
data := struct { data := struct {
Version, Tag string Version string
Major, Minor, Patch int64 Tag string
Env map[string]string Commit string
Major int64
Minor int64
Patch int64
Env map[string]string
}{ }{
Version: ctx.Version, Version: ctx.Version,
Commit: ctx.Git.Commit,
Tag: ctx.Git.CurrentTag, Tag: ctx.Git.CurrentTag,
Env: ctx.Env, Env: ctx.Env,
Major: sv.Major(), Major: sv.Major(),

View File

@ -78,6 +78,7 @@ func TestRunPipe(t *testing.T) {
"{{.Tag}}-{{.Env.FOO}}", "{{.Tag}}-{{.Env.FOO}}",
"v{{.Major}}", "v{{.Major}}",
"v{{.Major}}.{{.Minor}}", "v{{.Major}}.{{.Minor}}",
"commint-{{.Commit}}",
"latest", "latest",
}, },
Files: []string{ Files: []string{