mirror of
https://github.com/git-chglog/git-chglog.git
synced 2026-01-23 02:15:12 +00:00
chore: use ldflags to pass version to build process (#127)
This commit is contained in:
parent
9a0d584745
commit
3113e42524
3 changed files with 9 additions and 6 deletions
6
Makefile
6
Makefile
|
|
@ -1,3 +1,7 @@
|
|||
VERSION?=$$(git describe --tags --always)
|
||||
|
||||
LDFLAGS="-X main.version=$(VERSION)"
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -rf ./dist/
|
||||
|
|
@ -7,7 +11,7 @@ clean:
|
|||
|
||||
.PHONY: build
|
||||
build:
|
||||
go build -o git-chglog ./cmd/git-chglog
|
||||
go build -ldflags=$(LDFLAGS) -o git-chglog ./cmd/git-chglog
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
|
|
|
|||
|
|
@ -12,6 +12,9 @@ import (
|
|||
"github.com/urfave/cli/v2"
|
||||
)
|
||||
|
||||
// version is passed in via LDFLAGS main.version
|
||||
var version string
|
||||
|
||||
// CreateApp creates and initializes CLI application
|
||||
// with description, flags, version, etc.
|
||||
func CreateApp(actionFunc cli.ActionFunc) *cli.App {
|
||||
|
|
@ -74,7 +77,7 @@ func CreateApp(actionFunc cli.ActionFunc) *cli.App {
|
|||
app := cli.NewApp()
|
||||
app.Name = "git-chglog"
|
||||
app.Usage = "todo usage for git-chglog"
|
||||
app.Version = Version
|
||||
app.Version = version
|
||||
|
||||
app.Flags = []cli.Flag{
|
||||
// init
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
package main
|
||||
|
||||
// Version of git-chglog cli client
|
||||
const Version = "v0.12.0"
|
||||
Loading…
Add table
Add a link
Reference in a new issue