Finally got versions baked into the builds
continuous-integration/drone/push Build is failing Details

main
Nick Dumas 2 years ago
parent 7c38d9ae71
commit 04919ea208

@ -82,11 +82,12 @@ BENCHCPUS ?= 1,2,4
# Commands # Commands
GOCMD = go GOCMD = go
ARCHES ?= 386 amd64 ARCHES ?= amd64 386
OSES ?= windows linux darwin OSES ?= windows linux darwin
OUTTPL = $(DISTDIR)/$(NAME)-$(VERSION)-{{.OS}}_{{.Arch}}/{{.Dir}} OUTTPL = $(DISTDIR)/$(NAME)-$(VERSION)-{{.OS}}_{{.Arch}}/{{.Dir}}
LDFLAGS = -X $(PKG).Version=$(VERSION) -X $(PKG).Build=$(COMMIT_ID) LDFLAGS = -X $(PKG).Version=$(VERSION) -X $(PKG).Build=$(COMMIT_ID)
GOBUILD = gox -rebuild -gocmd="$(GOCMD)" -arch="$(ARCHES)" -os="$(OSES)" -output="$(OUTTPL)" -tags "$(BUILD_TAGS)" -ldflags "$(LDFLAGS)" GOBUILD = gox -rebuild -gocmd="$(GOCMD)" -arch="$(ARCHES)" -os="$(OSES)" -output="$(OUTTPL)" -tags "$(BUILD_TAGS)" -ldflags "$(LDFLAGS)"
GOBUILD_SIMPLE = go build -tags "$(BUILD_TAGS)" -ldflags "$(LDFLAGS)"
GOCLEAN = $(GOCMD) clean GOCLEAN = $(GOCMD) clean
GOINSTALL = $(GOCMD) install -a -tags "$(BUILD_TAGS)" -ldflags "$(LDFLAGS)" GOINSTALL = $(GOCMD) install -a -tags "$(BUILD_TAGS)" -ldflags "$(LDFLAGS)"
GOTEST = $(GOCMD) test -v -tags "$(BUILD_TAGS)" GOTEST = $(GOCMD) test -v -tags "$(BUILD_TAGS)"

@ -7,10 +7,8 @@ import (
"fmt" "fmt"
"github.com/spf13/cobra" "github.com/spf13/cobra"
)
var ( "code.ndumas.com/ndumas/obsidian-pipeline"
Version, Tag string
) )
// rootCmd represents the base command when called without any subcommands // rootCmd represents the base command when called without any subcommands
@ -20,7 +18,7 @@ var versionCmd = &cobra.Command{
Long: `displays git tag and sha Long: `displays git tag and sha
`, `,
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("%s %s\n", Version, Tag) fmt.Printf("Version: %s Build: %s\n", obp.Version, obp.Build)
}, },
} }

@ -3,14 +3,10 @@ Copyright © 2023 NAME HERE <EMAIL ADDRESS>
*/ */
package main package main
import "code.ndumas.com/ndumas/obsidian-pipeline/cmd/obp/cmd" import (
"code.ndumas.com/ndumas/obsidian-pipeline/cmd/obp/cmd"
var (
Version, Tag string
) )
func main() { func main() {
cmd.Version = Version
cmd.Tag = Tag
cmd.Execute() cmd.Execute()
} }

@ -0,0 +1,5 @@
package obp
var (
Version, Build string
)
Loading…
Cancel
Save