mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-02-03 13:11:48 +02:00
feat: change default snapshot version template (#1248)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
parent
65c9c12957
commit
173edbac54
@ -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
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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).
|
||||
|
Loading…
x
Reference in New Issue
Block a user