fix: correct daily version

This commit is contained in:
Michael Barz
2025-04-01 21:54:57 +02:00
parent 3bcef42910
commit 4bbd46d238
2 changed files with 11 additions and 13 deletions

View File

@@ -18,21 +18,20 @@ SOURCES ?= $(shell find . -name "*.go" -type f -not -path "./node_modules/*")
TAGS ?=
ifndef OUTPUT
ifneq ($(DRONE_TAG),)
OUTPUT ?= $(subst v,,$(DRONE_TAG))
ifneq ($(CI_COMMIT_TAG),)
OUTPUT ?= $(subst v,,$(CI_COMMIT_TAG))
else
OUTPUT ?= testing
endif
endif
ifndef VERSION
ifneq ($(DRONE_TAG),)
VERSION ?= $(subst v,,$(DRONE_TAG))
else
STRING ?= $(shell git rev-parse --short HEAD)
endif
ifeq ($(VERSION), daily)
STRING ?= $(shell git rev-parse --short HEAD)
else ifeq ($(VERSION),)
STRING ?= $(shell git rev-parse --short HEAD)
endif
ifndef DATE
DATE := $(shell date -u '+%Y%m%d')
endif

View File

@@ -46,18 +46,17 @@ func GetString() string {
// Parsed returns a semver Version
func Parsed() (version *semver.Version) {
versionToParse := LatestTag
if Tag != "" {
// use the placeholder version if the tag is empty or when we are creating a daily build
if Tag != "" && Tag != "daily" {
versionToParse = Tag
}
version, err := semver.NewVersion(versionToParse)
// We have no semver version but a commitid
if err != nil {
// this should never happen
if err != nil {
return &semver.Version{}
}
return &semver.Version{}
}
if String != "" {
// We have no tagged version but a commitid
nVersion, err := version.SetMetadata(String)
if err != nil {
return &semver.Version{}