Skip to content

Commit

Permalink
ci: update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
iret-kawashima committed Oct 16, 2023
1 parent 231d45f commit 36966f2
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,22 @@ build: clean
check: test bench vet cover golangci-lint govulncheck

.PHONY: deps
deps:
deps: deps-lint deps-govulncheck deps-gobump

.PHONY: deps-lint
deps-lint:
ifndef HAS_LINT
go install $(BIN_LINT)
endif

.PHONY: deps-govulncheck
deps-govulncheck:
ifndef HAS_VULNCHECK
go install $(BIN_GOVULNCHECK)
endif

.PHONY: deps-gobump
deps-gobump:
ifndef HAS_GOBUMP
go install $(BIN_GOBUMP)
endif
Expand All @@ -55,32 +64,37 @@ cover:
go tool cover -html=cover.out -o cover.html

.PHONY: golangci-lint
golangci-lint:
golangci-lint: deps-lint
golangci-lint run ./... -v --tests

.PHONY: govulncheck
govulncheck: deps
govulncheck: deps-govulncheck
$(GOBIN)/govulncheck -test -json ./...

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

.PHONY: publish
publish: deps
.PHONY: check-git
ifneq ($(shell git status --porcelain),)
$(error git workspace is dirty)
endif
ifneq ($(shell git rev-parse --abbrev-ref HEAD),main)
$(error current branch is not main)
endif

.PHONY: publish
publish: deps-gobump check-git
$(GOBIN)/gobump up -w .
git commit -am "bump up version to $(VERSION) [skip ci]"
git tag "v$(VERSION)"
git commit -am "bump up version to $(VERSION)"
git push origin main

.PHONY: release
release: check-git
git tag "v$(VERSION)"
git push origin "refs/tags/v$(VERSION)"

.PHONY: clean
clean:
go clean
rm -f $(BIN)
rm -f $(BIN) cover.out cover.html

0 comments on commit 36966f2

Please sign in to comment.