Skip to content

Commit

Permalink
Use github_ref_name if available
Browse files Browse the repository at this point in the history
  • Loading branch information
plorenz committed Jun 11, 2024
1 parent 46f5c54 commit 489d7db
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmd/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,16 @@ func (cmd *BaseCommand) EvalCurrentAndNextVersion() {
}

if cmd.useCurrentTag {
tag := cmd.runCommandWithOutput("get current git tag", "git", "describe", "--tags")
v, err := version.NewVersion(tag[0])
tag := ""
if strings.EqualFold("true", os.Getenv("GITHUB_ACTIONS")) {
tag = os.Getenv("GITHUB_REF_NAME")
} else {
tags := cmd.runCommandWithOutput("get current git tag", "git", "describe", "--tags")
tag = tags[0]
}
v, err := version.NewVersion(tag)
if err != nil {
panic(fmt.Errorf("unable to parse tag %s", tag[0]))
panic(fmt.Errorf("unable to parse tag %s", tag))
}

cmd.CurrentVersion = v
Expand Down

0 comments on commit 489d7db

Please sign in to comment.