Skip to content

Commit

Permalink
feat: change default snapshot version template (#1248)
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
  • Loading branch information
caarlos0 committed Nov 15, 2019
1 parent 65c9c12 commit 173edba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/pipe/snapshot/snapshot.go
Expand Up @@ -20,7 +20,7 @@ func (Pipe) String() string {
// Default sets the pipe defaults
func (Pipe) Default(ctx *context.Context) error {
if ctx.Config.Snapshot.NameTemplate == "" {
ctx.Config.Snapshot.NameTemplate = "SNAPSHOT-{{ .ShortCommit }}"
ctx.Config.Snapshot.NameTemplate = "{{ .Tag }}-SNAPSHOT-{{ .ShortCommit }}"
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/pipe/snapshot/snapshot_test.go
Expand Up @@ -19,7 +19,7 @@ func TestDefault(t *testing.T) {
},
}
assert.NoError(t, Pipe{}.Default(ctx))
assert.Equal(t, "SNAPSHOT-{{ .ShortCommit }}", ctx.Config.Snapshot.NameTemplate)
assert.Equal(t, "{{ .Tag }}-SNAPSHOT-{{ .ShortCommit }}", ctx.Config.Snapshot.NameTemplate)
}

func TestDefaultSet(t *testing.T) {
Expand Down
8 changes: 6 additions & 2 deletions www/content/snapshots.md
Expand Up @@ -15,8 +15,12 @@ and also with the `snapshot` customization section:
# .goreleaser.yml
snapshot:
# Allows you to change the name of the generated snapshot
# Default is `SNAPSHOT-{{.ShortCommit}}`.
name_template: SNAPSHOT-{{.Commit}}
#
# Note that some pipes require this to be semantic version compliant (nfpm,
# for example).
#
# Default is `{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}`.
name_template: 1.2.3-SNAPSHOT-{{.Commit}}
```

> Learn more about the [name template engine](/templates).
Expand Down

0 comments on commit 173edba

Please sign in to comment.