-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
34 lines (29 loc) · 817 Bytes
/
makefile
File metadata and controls
34 lines (29 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
.PHONY: all
all: up lint test
cd examples/make && make all
.PHONY: up
up:
go get -u ./...
go mod tidy
.PHONY: lint
lint:
golangci-lint fmt ./...
golangci-lint run ./...
.PHONY: test
test:
go test ./...
.PHONY: release
release: all
@echo "Creating release..."
@if ! git diff-index --quiet HEAD --; then \
echo "Error: Working directory is not clean. Please commit or stash changes."; \
exit 1; \
fi
@LATEST_TAG=$$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0"); \
echo "Latest tag: $$LATEST_TAG"; \
VERSION=$$(echo $$LATEST_TAG | sed 's/^v//' | awk -F. '{print $$1"."$$2"."$$3+1}'); \
NEW_TAG="v$$VERSION"; \
echo "Creating new tag: $$NEW_TAG"; \
git tag -a $$NEW_TAG -m "Release $$NEW_TAG"; \
git push origin $$NEW_TAG; \
echo "Successfully created and pushed tag: $$NEW_TAG"