Skip to content

Commit

Permalink
(version): Get the version from Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
erbesharat committed Jan 7, 2020
1 parent f1e774d commit 0a5f848
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
BIN := txtdirect
DOMAIN := c.txtdirect.org
VERSION := 0.4.0
VERSION := $(shell cat ./VERSION)
IMAGE := $(DOMAIN)/$(BIN):$(VERSION)
CODEPATH := $(shell go list -m)

BUILD_GOOS := $(if $(GOOS),$(GOOS),linux)
BUILD_GOARCH := $(if $(GOARCH),$(GOARCH),amd64)
Expand All @@ -12,7 +13,7 @@ CONTAINER ?= $(BIN)

build:
cd cmd/txtdirect && \
GO111MODULE=on CGO_ENABLED=0 GOARCH=$(BUILD_GOARCH) GOOS=$(BUILD_GOOS) go build -ldflags="-s -w"
GO111MODULE=on CGO_ENABLED=0 GOARCH=$(BUILD_GOARCH) GOOS=$(BUILD_GOOS) go build -ldflags="-s -w -X $(CODEPATH)/txtdirectmain.TXTDirectVersion=$(VERSION)"
mv cmd/txtdirect/txtdirect ./$(BIN)

test:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.2.0
v0.4.0-beta
11 changes: 7 additions & 4 deletions txtdirectmain/version.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package txtdirectmain

// Various CoreDNS constants.
// Various TXTDirect constants.
const (
TXTDirectVersion = "0.4.0"
TXTDirectName = "TXTDirect"
serverType = "http"
TXTDirectName = "TXTDirect"
serverType = "http"
)

// TXTDirectVersion gets filled in the build time using -ldflags
// Check the Makefile for more information.
var TXTDirectVersion = ""

0 comments on commit 0a5f848

Please sign in to comment.