Skip to content

Commit

Permalink
fix: ignore prerelease tags
Browse files Browse the repository at this point in the history
this would fix #155 I think... but would also probably be a breaking
change.. not sure about it yet
  • Loading branch information
caarlos0 committed May 21, 2024
1 parent 7cf187a commit f920e45
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os/exec"
"strings"

"github.com/Masterminds/semver"
"github.com/gobwas/glob"
)

Expand Down Expand Up @@ -43,7 +44,17 @@ func DescribeTag(tagMode string, pattern string) (string, error) {
if len(tags) == 0 {
return "", nil
}

if pattern == "" {
for _, tag := range tags {
v, err := semver.NewVersion(tag)
if err != nil {
continue
}
if v.Prerelease() == "" {
return tag, nil
}
}
return tags[0], nil
}

Expand Down

0 comments on commit f920e45

Please sign in to comment.