]> git.lizzy.rs Git - micro.git/blobdiff - tools/build-version.go
Add extra nightly release message
[micro.git] / tools / build-version.go
index a8e68d01c9eb8affb593f86a9a6d6f68f4b7507e..ead81a43c2ed4321ec6d61ecba50edfe59222fad 100644 (file)
@@ -20,9 +20,13 @@ func getTag(match ...string) (string, *semver.PRVersion) {
                        if ahead, err := semver.NewPRVersion(tagParts[1]); err == nil {
                                return tagParts[0], &ahead
                        }
+               } else if len(tagParts) == 4 {
+                       if ahead, err := semver.NewPRVersion(tagParts[2]); err == nil {
+                               return tagParts[0] + "-" + tagParts[1], &ahead
+                       }
                }
 
-               return tagParts[0], nil
+               return string(tag), nil
        }
 }
 
@@ -32,7 +36,7 @@ func main() {
        version, err := semver.ParseTolerant(versionStr)
        if err != nil {
                // no version tag found so just return what ever we can find.
-               fmt.Println(getTag())
+               fmt.Println("0.0.0-unknown")
                return
        }
        // Get the tag of the current revision.
@@ -49,7 +53,9 @@ func main() {
                tag = "dev"
        }
        // Get the most likely next version:
-       version.Patch = version.Patch + 1
+       if !strings.Contains(version.String(), "rc") {
+               version.Patch = version.Patch + 1
+       }
 
        if pr, err := semver.NewPRVersion(tag); err == nil {
                // append the tag as pre-release name