From 1a2d8cbfc6339bbb084b87c70c3f3d96bf36475f Mon Sep 17 00:00:00 2001 From: Jess Frazelle Date: Wed, 7 Jun 2017 11:36:16 -0400 Subject: [PATCH] update makefile to bump version Signed-off-by: Jess Frazelle --- Makefile | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f1b2871..b8e38b6 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ $(NAME): *.go VERSION go build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . .PHONY: static -static: # Builds a static executable +static: ## Builds a static executable @echo "+ $@" CGO_ENABLED=0 go build \ -tags "$(BUILDTAGS) static_build" \ @@ -96,6 +96,19 @@ release: *.go VERSION ## Builds the cross-compiled binaries, naming them in such @echo "+ $@" $(foreach GOOSARCH,$(GOOSARCHES), $(call buildrelease,$(subst /,,$(dir $(GOOSARCH))),$(notdir $(GOOSARCH)))) +.PHONY: bump-version +BUMP := patch +bump-version: ## Bump the version in the version file. Set KIND to [ patch | major | minor ] + @go get -u github.com/jessfraz/junk/sembump # update sembump tool + $(eval NEW_VERSION = $(shell sembump --kind $(BUMP) $(VERSION))) + @echo "Bumping VERSION from $(VERSION) to $(NEW_VERSION)" + echo $(NEW_VERSION) > VERSION + @echo "Updating links to download binaries in README.md" + sed -i s/$(VERSION)/$(NEW_VERSION)/g README.md + git add VERSION README.md + git commit -vsam "Bump version to $(NEW_VERSION)" + @echo "Run make tag to create and push the tag for new version $(NEW_VERSION)" + .PHONY: tag tag: ## Create a new git tag to prepare to build a release git tag -sa $(VERSION) -m "$(VERSION)"