Skip to content

Commit

Permalink
Merge pull request #166 from motemen/add-make-bump
Browse files Browse the repository at this point in the history
add make bump
  • Loading branch information
itchyny authored Jan 11, 2020
2 parents 81ba2d7 + a6c5943 commit 84d01ce
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
BIN := gore
VERSION := $$(make -s show-version)
CURRENT_REVISION := $(shell git rev-parse --short HEAD)
BUILD_LDFLAGS := "-s -w -X github.com/motemen/$(BIN)/cli.revision=$(CURRENT_REVISION)"
GOBIN ?= $(shell go env GOPATH)/bin
Expand All @@ -15,6 +16,13 @@ build:
install:
go install -ldflags=$(BUILD_LDFLAGS) ./cmd/...

.PHONY: show-version
show-version: $(GOBIN)/gobump
@gobump show -r $(VERSION_PATH)

$(GOBIN)/gobump:
@cd && go get github.com/motemen/gobump/cmd/gobump

.PHONY: test
test: build
go test -v ./...
Expand All @@ -31,3 +39,16 @@ $(GOBIN)/golint:
clean:
rm -f $(BIN)
go clean

.PHONY: bump
bump: $(GOBIN)/gobump
ifneq ($(shell git status --porcelain),)
$(error git workspace is dirty)
endif
ifneq ($(shell git rev-parse --abbrev-ref HEAD),master)
$(error current branch is not master)
endif
@gobump up -w
git checkout -b "bump-version-$(VERSION)"
git commit -am "bump up version to $(VERSION)"
git push origin "bump-version-$(VERSION)"

0 comments on commit 84d01ce

Please sign in to comment.