Skip to content

Commit

Permalink
feat(featctl/makefile): add release command
Browse files Browse the repository at this point in the history
  • Loading branch information
lianxmfor committed Nov 4, 2021
1 parent 64bf7cd commit 7d2f188
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions featctl/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
VERSION = $(shell (git describe --tags --abbrev=0 2>/dev/null || echo '0.0.0') | tr -d v)
COMMIT = $(shell git rev-parse --short HEAD)

PLATFORMS := darwin/amd64 linux/amd64 windows/amd64
temp = $(subst /, ,$@)
os = $(word 1, $(temp))
arch = $(word 2, $(temp))

OUT = build/

.DEFAULT_GOAL := build
Expand All @@ -17,6 +22,16 @@ build:
-X $$(go list -m)/version.Commit=$(COMMIT) \
-X $$(go list -m)/version.Built=$$(date -u +%FT%T+00:00)"

release: $(PLATFORMS)

$(PLATFORMS):
@ GOOS=$(os) GOARCH=$(arch) go build -o $(OUT)featctl-$(os)-$(arch) -ldflags "-s -w \
-X $$(go list -m)/version.Version=$(VERSION) \
-X $$(go list -m)/version.Commit=$(COMMIT) \
-X $$(go list -m)/version.Built=$$(date -u +%FT%T+00:00)"

.PHONY: release $(PLATFORMS)

.PHONY: test
test:
@go test -race -coverprofile=coverage.out -covermode=atomic ./...
Expand Down

0 comments on commit 7d2f188

Please sign in to comment.