1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-09 13:36:56 +02:00

Merge pull request #240 from goreleaser/version

added version to default name_template
This commit is contained in:
Carlos Alexandro Becker 2017-05-20 15:10:40 -03:00 committed by GitHub
commit f3e271840b
4 changed files with 6 additions and 5 deletions

View File

@ -259,7 +259,7 @@ archive:
# - Os
# - Arch
# - Arm (ARM version)
# The default is `{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}`
# The default is `{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}`
name_template: "{{.Binary}}_{{.Version}}_{{.Os}}_{{.Arch}}"
# Archive format. Valid options are `tar.gz` and `zip`.

View File

@ -13,6 +13,7 @@ build:
- arm
- arm64
archive:
name_template: '{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
darwin: Darwin
linux: Linux

View File

@ -73,9 +73,9 @@ func TestNameDefaltTemplate(t *testing.T) {
Version: "1.2.3",
}
for key, target := range map[string]buildTarget{
"test_darwin_amd64": {"darwin", "amd64", ""},
"test_linux_arm64": {"linux", "arm64", ""},
"test_linux_armv7": {"linux", "arm", "7"},
"test_1.2.3_darwin_amd64": {"darwin", "amd64", ""},
"test_1.2.3_linux_arm64": {"linux", "arm64", ""},
"test_1.2.3_linux_armv7": {"linux", "arm", "7"},
} {
t.Run(key, func(t *testing.T) {
name, err := nameFor(ctx, target)

View File

@ -9,7 +9,7 @@ import (
)
// NameTemplate default name_template for the archive.
const NameTemplate = "{{ .Binary }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
const NameTemplate = "{{ .Binary }}_{{.Version}}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
// SnapshotNameTemplate represents the default format for snapshot release names.
const SnapshotNameTemplate = "SNAPSHOT-{{ .Commit }}"