You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-11-29 23:07:42 +02:00
feat: snapshot.name_template should use tag instead of version (#2417)
* fix: Change the init-template for snapshot.name_template * fix: Change the default-template for snapshot.name_template BREAKIND CHANGE: The default value of `snapshot.name_template` is changed.
This commit is contained in:
@@ -5,7 +5,7 @@ before:
|
||||
- go mod tidy
|
||||
- ./scripts/completions.sh
|
||||
snapshot:
|
||||
name_template: '{{ incpatch .Tag }}-next'
|
||||
name_template: '{{ incpatch .Version }}-next'
|
||||
gomod:
|
||||
proxy: true
|
||||
builds:
|
||||
|
||||
2
cmd/testdata/good.yml
vendored
2
cmd/testdata/good.yml
vendored
@@ -19,7 +19,7 @@ archives:
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "{{ incpatch .Tag }}-next"
|
||||
name_template: "{{ incpatch .Version }}-next"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
|
||||
@@ -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 = "{{ .Tag }}-SNAPSHOT-{{ .ShortCommit }}"
|
||||
ctx.Config.Snapshot.NameTemplate = "{{ .Version }}-SNAPSHOT-{{ .ShortCommit }}"
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ func TestDefault(t *testing.T) {
|
||||
},
|
||||
}
|
||||
require.NoError(t, Pipe{}.Default(ctx))
|
||||
require.Equal(t, "{{ .Tag }}-SNAPSHOT-{{ .ShortCommit }}", ctx.Config.Snapshot.NameTemplate)
|
||||
require.Equal(t, "{{ .Version }}-SNAPSHOT-{{ .ShortCommit }}", ctx.Config.Snapshot.NameTemplate)
|
||||
}
|
||||
|
||||
func TestDefaultSet(t *testing.T) {
|
||||
|
||||
@@ -29,7 +29,7 @@ archives:
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "{{ incpatch .Tag }}-next"
|
||||
name_template: "{{ incpatch .Version }}-next"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
|
||||
@@ -16,8 +16,8 @@ snapshot:
|
||||
# Note that some pipes require this to be semantic version compliant (nfpm,
|
||||
# for example).
|
||||
#
|
||||
# Default is `{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}`.
|
||||
name_template: '{{ incpatch .Tag }}-devel'
|
||||
# Default is `{{ .Version }}-SNAPSHOT-{{.ShortCommit}}`.
|
||||
name_template: '{{ incpatch .Version }}-devel'
|
||||
```
|
||||
|
||||
## How it works
|
||||
|
||||
@@ -13,7 +13,7 @@ On fields that support templating, these fields are always available:
|
||||
| Key | Description |
|
||||
|---------------------|------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `.ProjectName` | the project name |
|
||||
| `.Version` | the version being released (`v` prefix stripped),<br>or `{{ .Tag }}-SNAPSHOT-{{ .ShortCommit }}` in case of snapshot release |
|
||||
| `.Version` | the version being released (`v` prefix stripped),<br>or what is configured in `snapshot.name_template` in case of a snapshot release (defaults to `{{ .Version }}-SNAPSHOT-{{.ShortCommit}}`) |
|
||||
| `.Branch` | the current git branch |
|
||||
| `.PrefixedTag` | the current git tag prefixed with the monorepo config tag prefix (if any) |
|
||||
| `.Tag` | the current git tag |
|
||||
|
||||
Reference in New Issue
Block a user