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
# Path to the Dockerfile (from the project root).
dockerfile: Dockerfile
# Template of the docker tag. Defaults to `{{ .Version }}`. Other allowed
# fields are `.Tag`, `.Major`, `.Minor` and `.Patch` and
# `.Env.VARIABLE_NAME`.
# Template of the docker tag. Defaults to `{{ .Version }}`.
# Other allowed fields are:
# - `.Commint`
# - `.Tag`
# - `.Major`
# - `.Minor`
# - `.Patch`
# - `.Env.VARIABLE_NAME`
tag_templates:
- "{{ .Tag }}"
- "{{ .Tag }}-{{ .Env.GO_VERSION }}"

View File

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

View File

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