-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
34 lines (32 loc) · 960 Bytes
/
Makefile
File metadata and controls
34 lines (32 loc) · 960 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
34
.PHONY: all build generate clean test
generate:
go generate ./...
tag:
@echo "Creating next tag..."
@bash -c ' \
PREV_TAG=$$(git tag --sort=-version:refname | head -1); \
if [ -z "$$PREV_TAG" ]; then \
NEXT_TAG="v0.0.1"; \
else \
VERSION=$$(echo $$PREV_TAG | sed "s/v//"); \
MAJOR=$$(echo $$VERSION | cut -d. -f1); \
MINOR=$$(echo $$VERSION | cut -d. -f2); \
PATCH=$$(echo $$VERSION | cut -d. -f3); \
NEXT_MINOR=$$((MINOR + 1)); \
NEXT_TAG="v$$MAJOR.$$NEXT_MINOR.0"; \
fi; \
echo "Previous tag: $$PREV_TAG"; \
echo "Next tag: $$NEXT_TAG"; \
echo ""; \
echo "Changelog:"; \
git changelog $$PREV_TAG..; \
echo ""; \
read -p "Create tag $$NEXT_TAG? [y/N] " -n 1 -r; \
echo ""; \
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
CHANGELOG=$$(git changelog $$PREV_TAG..); \
git tag -a $$NEXT_TAG -m "Version $$NEXT_TAG" -m "" -m "$$CHANGELOG"; \
echo "Tag $$NEXT_TAG created successfully"; \
else \
echo "Tag creation cancelled"; \
fi'