Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sort tags by numerical value not text date #2379

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/pipe/git/git.go
Expand Up @@ -177,7 +177,7 @@ func getTag() (string, error) {
return os.Getenv("GORELEASER_CURRENT_TAG"), nil
},
func() (string, error) {
return git.Clean(git.Run("tag", "--points-at", "HEAD", "--sort", "-version:creatordate"))
return git.Clean(git.Run("tag", "--points-at", "HEAD", "--sort", "-version:refname"))
},
func() (string, error) {
return git.Clean(git.Run("describe", "--tags", "--abbrev=0"))
Expand Down
5 changes: 1 addition & 4 deletions internal/pipe/git/git_test.go
Expand Up @@ -233,10 +233,7 @@ func TestTagFromCI(t *testing.T) {
envs map[string]string
expected string
}{
// It is not possible to concisely figure out the tag if a commit has more than one tags. Git always
// returns the tags in lexicographical order (ASC), which implies that we expect v0.0.1 here.
// More details: https://github.com/goreleaser/goreleaser/issues/1163
{expected: "v0.0.1"},
{expected: "v0.0.2"},
{
envs: map[string]string{"GORELEASER_CURRENT_TAG": "v0.0.2"},
expected: "v0.0.2",
Expand Down