goshorly/utils/build-vars.go
2023-04-05 22:29:43 +02:00

30 lines
563 B
Go

package utils
import (
"fmt"
"time"
)
var (
CI_COMMIT_SHORT_SHA string
CI_COMMIT_BRANCH string
CI_COMMIT_TAG string
CI_TAGGED bool
CI_BUILD bool
)
func Init_build_vars() {
CI_BUILD = CI_COMMIT_SHORT_SHA != "" || CI_COMMIT_BRANCH != ""
CI_TAGGED = CI_COMMIT_TAG != ""
}
func Print_Starting_Screen() {
version := "unknown version"
if CI_TAGGED {
version = CI_COMMIT_TAG
} else if CI_BUILD {
version = CI_COMMIT_SHORT_SHA
}
fmt.Println("---- Starting goshorly " + version + " ----")
time.Sleep(1 * time.Second)
}