X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=tools%2Fbuild-version.go;h=8194fba66497ff2631cb82e4173f764a79253779;hb=cc0af275c1d37fbe039ee8927c6ec3912eeabfd4;hp=ead81a43c2ed4321ec6d61ecba50edfe59222fad;hpb=6957e83cdbb57e590709a0392d5854aed00206ea;p=micro.git diff --git a/tools/build-version.go b/tools/build-version.go index ead81a43..8194fba6 100644 --- a/tools/build-version.go +++ b/tools/build-version.go @@ -1,3 +1,5 @@ +//+build ignore + package main import ( @@ -31,6 +33,10 @@ func getTag(match ...string) (string, *semver.PRVersion) { } func main() { + if tags, err := exec.Command("git", "tag").Output(); err != nil || len(tags) == 0 { + // no tags found -- fetch them + exec.Command("git", "fetch", "--tags").Run() + } // Find the last vX.X.X Tag and get how many builds we are ahead of it. versionStr, ahead := getTag("--match", "v*") version, err := semver.ParseTolerant(versionStr) @@ -49,7 +55,7 @@ func main() { } // If we don't have any tag assume "dev" - if tag == "" { + if tag == "" || strings.HasPrefix(tag, "nightly") { tag = "dev" } // Get the most likely next version: