-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
18 lines (16 loc) · 877 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
precommit: test
test:
@ go vet ./...
@ go run honnef.co/go/tools/cmd/staticcheck@latest ./...
@ go test -race -count=20 ./...
release: VERSION := $(shell awk '/[0-9]+\.[0-9]+\.[0-9]+/ {print $$2; exit}' Changelog.md)
release: test
@ go mod tidy
@ test -n "$(VERSION)" || (echo "Unable to read the version." && false)
@ test -z "`git tag -l v$(VERSION)`" || (echo "Aborting because the v$(VERSION) tag already exists." && false)
@ test -z "`git status --porcelain | grep -vE 'M (Changelog\.md)'`" || (echo "Aborting from uncommitted changes." && false)
@ test -n "`git status --porcelain | grep -v 'M (Changelog\.md)'`" || (echo "Changelog.md must have changes" && false)
@ git commit -am "Release v$(VERSION)"
@ git tag "v$(VERSION)"
@ git push origin main "v$(VERSION)"
@ go run github.com/cli/cli/v2/cmd/gh@5023b61 release create --generate-notes "v$(VERSION)"