Skip to content

Commit

Permalink
bali: 1.2.11 support detect tagName for Github
Browse files Browse the repository at this point in the history
  • Loading branch information
fcharlie committed Jun 11, 2021
1 parent 130a215 commit 17265a6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
2 changes: 1 addition & 1 deletion cmd/bali/balisrc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ icon = "res/bali.ico"
manifest = "res/bali.manifest"
goflags = [
"-ldflags",
"-X 'main.VERSION=$BUILD_VERSION' -X 'main.BUILDTIME=$BUILD_TIME' -X 'main.BUILDBRANCH=$BUILD_BRANCH' -X 'main.BUILDCOMMIT=$BUILD_COMMIT' -X 'main.GOVERSION=$BUILD_GOVERSION'",
"-X 'main.VERSION=$BUILD_VERSION' -X 'main.BUILDTIME=$BUILD_TIME' -X 'main.BUILDBRANCH=$BUILD_BRANCH' -X 'main.BUILDCOMMIT=$BUILD_COMMIT' -X 'main.BUILDREFNAME=$BUILD_REFNAME' -X 'main.GOVERSION=$BUILD_GOVERSION'",
]
37 changes: 27 additions & 10 deletions cmd/bali/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ var (

// version info
var (
VERSION = "1.2.11"
BUILDTIME string = "NONE"
BUILDCOMMIT string = "NONE"
BUILDBRANCH string = "NONE"
GOVERSION string
VERSION = "1.2.11"
BUILDTIME string = "NONE"
BUILDCOMMIT string = "NONE"
BUILDBRANCH string = "NONE"
BUILDREFNAME string = "NONE"
GOVERSION string
)

func init() {
Expand All @@ -33,11 +34,27 @@ func init() {
}

func version() {
fmt.Fprint(os.Stdout, "Bali - Minimalist Golang build and packaging tool\nversion: ", VERSION, "\n",
"build branch: ", BUILDBRANCH, "\n",
"build commit: ", BUILDCOMMIT, "\n",
"build time: ", BUILDTIME, "\n",
"go version: ", GOVERSION, "\n")
const template = `Bali - Minimalist Golang build and packaging tool
Version: %s
Branch: %s
Commit: %s
Build Time: %s
Go Version: %s
`
const tagTemplate = `Bali - Minimalist Golang build and packaging tool
Version: %s
Release: %s
Commit: %s
Build Time: %s
Go Version: %s
`
if len(BUILDBRANCH) != 0 {
fmt.Fprintf(os.Stdout, template, VERSION, BUILDBRANCH, BUILDCOMMIT, BUILDTIME, GOVERSION)
return
}
fmt.Fprintf(os.Stdout, tagTemplate, VERSION, strings.TrimPrefix(BUILDREFNAME, "refs/tags/"), BUILDCOMMIT, BUILDTIME, GOVERSION)
}

func usage() {
Expand Down

0 comments on commit 17265a6

Please sign in to comment.