Skip to content

Commit

Permalink
Calculate version correctly when multiple tags are present
Browse files Browse the repository at this point in the history
When multiple tags are present on the same commit, the version was
calculated incorrectly. E.g., when `latest`, `canary` and `v1.1.0` tags
are present on the same commit, the command seems to sort alphabetically
causing the version to always be set to `canary`. This behaviour breaks
makes it impossible to release a finalized version, e.g., `v1.1.0`.

Using matching results in the version being calculated from the latest
released version. The version will look like this `v1.1.0-2-gf3862833`
instead of `canary`.

Signed-off-by: Kim Christensen <[email protected]>
  • Loading branch information
kichristensen committed Jun 27, 2024
1 parent 9808687 commit f605ad4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion releases/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func getCommit() string {

// Get a description of the commit, e.g. v0.30.1 (latest) or v0.30.1-32-gfe72ff73 (canary)
func getVersion() string {
version, _ := shx.OutputS("git", "describe", "--tags")
version, _ := shx.OutputS("git", "describe", "--tags", "--match=v*")
if version != "" {
return version
}
Expand Down

0 comments on commit f605ad4

Please sign in to comment.