mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-06 03:13:48 +02:00
refactor: use git tag --points-at (#1796)
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
parent
cfd53dc728
commit
01942ae60d
@ -148,11 +148,26 @@ func getFullCommit() (string, error) {
|
||||
}
|
||||
|
||||
func getTag() (string, error) {
|
||||
if tag := os.Getenv("GORELEASER_CURRENT_TAG"); tag != "" {
|
||||
return tag, nil
|
||||
var tag string
|
||||
var err error
|
||||
for _, fn := range []func() (string, error){
|
||||
func() (string, error) {
|
||||
return os.Getenv("GORELEASER_CURRENT_TAG"), nil
|
||||
},
|
||||
func() (string, error) {
|
||||
return git.Clean(git.Run("tag", "--points-at", "HEAD", "--sort", "-version:creatordate"))
|
||||
},
|
||||
func() (string, error) {
|
||||
return git.Clean(git.Run("describe", "--tags", "--abbrev=0"))
|
||||
},
|
||||
} {
|
||||
tag, err = fn()
|
||||
if tag != "" || err != nil {
|
||||
return tag, err
|
||||
}
|
||||
}
|
||||
|
||||
return git.Clean(git.Run("describe", "--tags", "--abbrev=0"))
|
||||
return tag, err
|
||||
}
|
||||
|
||||
func getURL() (string, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user