Changed: DB Params
This commit is contained in:
29
templ/get-version/main.go
Normal file
29
templ/get-version/main.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
gitPath, err := exec.LookPath("git")
|
||||
if err != nil {
|
||||
log.Fatalf("failed to find git on path: %v", err)
|
||||
}
|
||||
|
||||
cmd := exec.Command(gitPath, "rev-list", "main", "--count")
|
||||
output, err := cmd.Output()
|
||||
if err != nil {
|
||||
log.Fatalf("failed to run git: %v", err)
|
||||
}
|
||||
count, err := strconv.Atoi(strings.TrimSpace(string(output)))
|
||||
if err != nil {
|
||||
log.Fatalf("failed to parse git output: %v", err)
|
||||
}
|
||||
|
||||
// The current commit isn't the one we're about to commit.
|
||||
fmt.Printf("0.3.%d", count+1)
|
||||
}
|
Reference in New Issue
Block a user