Allowing to specify different branch in first parameter
This commit is contained in:
@@ -140,8 +140,39 @@ func main() {
|
|||||||
default:
|
default:
|
||||||
Patch++
|
Patch++
|
||||||
}
|
}
|
||||||
// Update SemVer
|
startArgs := 1
|
||||||
SemVer = fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch)
|
br := strings.Split(GitRef, "/")
|
||||||
|
branch := br[len(br)-1]
|
||||||
|
if major || minor {
|
||||||
|
branch = os.Args[2]
|
||||||
|
}
|
||||||
|
var out string
|
||||||
|
if out, e = runCmdWithOutput("git", "branch"); check(e) {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
splitted := strings.Split(out, "\n")
|
||||||
|
var isBranch bool
|
||||||
|
for i := range splitted {
|
||||||
|
if len(splitted[i]) < 2 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if splitted[i][2:] == branch {
|
||||||
|
log.I.S(splitted[i][2:])
|
||||||
|
isBranch = true
|
||||||
|
branch = splitted[i][2:]
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if isBranch {
|
||||||
|
startArgs++
|
||||||
|
}
|
||||||
|
tag := true
|
||||||
|
if branch == "main" {
|
||||||
|
// Update SemVer
|
||||||
|
SemVer = fmt.Sprintf("v%d.%d.%d", Major, Minor, Patch)
|
||||||
|
} else {
|
||||||
|
tag = false
|
||||||
|
}
|
||||||
PathBase = tr.Filesystem.Root() + "/"
|
PathBase = tr.Filesystem.Root() + "/"
|
||||||
versionFile := `// Package indra is the root level package for Indranet, a low latency,
|
versionFile := `// Package indra is the root level package for Indranet, a low latency,
|
||||||
// Lightning Network monetised distributed VPN protocol designed for providing
|
// Lightning Network monetised distributed VPN protocol designed for providing
|
||||||
@@ -212,35 +243,6 @@ func Version() string {
|
|||||||
"\tMinor:", Minor, "\n",
|
"\tMinor:", Minor, "\n",
|
||||||
"\tPatch:", Patch, "\n",
|
"\tPatch:", Patch, "\n",
|
||||||
)
|
)
|
||||||
br := strings.Split(GitRef, "/")
|
|
||||||
branch := br[len(br)-1]
|
|
||||||
if major || minor {
|
|
||||||
branch = os.Args[2]
|
|
||||||
}
|
|
||||||
var out string
|
|
||||||
if out, e = runCmdWithOutput("git", "branch"); check(e) {
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
splitted := strings.Split(out, "\n")
|
|
||||||
log.I.S(splitted)
|
|
||||||
var isBranch bool
|
|
||||||
for i := range splitted {
|
|
||||||
if len(splitted[i]) < 2 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
log.I.Ln(branch)
|
|
||||||
if splitted[i][2:] == branch {
|
|
||||||
log.I.S(splitted[i][2:])
|
|
||||||
isBranch = true
|
|
||||||
branch = splitted[i][2:]
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
startArgs := 1
|
|
||||||
if isBranch {
|
|
||||||
startArgs++
|
|
||||||
}
|
|
||||||
log.I.Ln(branch)
|
|
||||||
if e = runCmd("git", "add", "."); check(e) {
|
if e = runCmd("git", "add", "."); check(e) {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
@@ -249,8 +251,10 @@ func Version() string {
|
|||||||
if e = runCmd("git", "commit", "-m"+commitString); check(e) {
|
if e = runCmd("git", "commit", "-m"+commitString); check(e) {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
if e = runCmd("git", "tag", SemVer); check(e) {
|
if tag {
|
||||||
os.Exit(1)
|
if e = runCmd("git", "tag", SemVer); check(e) {
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if e = runCmd("git", "push", "origin", branch); check(e) {
|
if e = runCmd("git", "push", "origin", branch); check(e) {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ var (
|
|||||||
// GitRef is the gitref, as in refs/heads/branchname.
|
// GitRef is the gitref, as in refs/heads/branchname.
|
||||||
GitRef = "refs/heads/main"
|
GitRef = "refs/heads/main"
|
||||||
// ParentGitCommit is the commit hash of the parent HEAD.
|
// ParentGitCommit is the commit hash of the parent HEAD.
|
||||||
ParentGitCommit = "2abadd782265b1103b5cc259ea3eba60d03a5f0c"
|
ParentGitCommit = "395f888f11a92d6b19967c8f0e89cc25fef1105c"
|
||||||
// BuildTime stores the time when the current binary was built.
|
// BuildTime stores the time when the current binary was built.
|
||||||
BuildTime = "2022-12-21T14:26:27Z"
|
BuildTime = "2022-12-21T14:31:39Z"
|
||||||
// SemVer lists the (latest) git tag on the build.
|
// SemVer lists the (latest) git tag on the build.
|
||||||
SemVer = "v0.0.204"
|
SemVer = "v0.0.205"
|
||||||
// PathBase is the path base returned from runtime caller.
|
// PathBase is the path base returned from runtime caller.
|
||||||
PathBase = "/home/loki/src/github.com/Indra-Labs/indra/"
|
PathBase = "/home/loki/src/github.com/Indra-Labs/indra/"
|
||||||
// Major is the major number from the tag.
|
// Major is the major number from the tag.
|
||||||
@@ -25,7 +25,7 @@ var (
|
|||||||
// Minor is the minor number from the tag.
|
// Minor is the minor number from the tag.
|
||||||
Minor = 0
|
Minor = 0
|
||||||
// Patch is the patch version number from the tag.
|
// Patch is the patch version number from the tag.
|
||||||
Patch = 204
|
Patch = 205
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version returns a pretty printed version information string.
|
// Version returns a pretty printed version information string.
|
||||||
|
|||||||
Reference in New Issue
Block a user