Skip to content

Commit 9b47a5b

Browse files
committed
add makefile
1 parent 3b6fa3f commit 9b47a5b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.PHONY: patch minor major tag
2+
3+
# Find the latest tag (default to 0.0.0 if none found)
4+
LATEST_TAG := $(shell git tag --list 'v*' --sort=-v:refname | head -n 1)
5+
VERSION := $(shell echo $(LATEST_TAG) | sed 's/^v//' || echo "0.0.0")
6+
7+
patch: ## Create a new patch release (x.y.Z+1)
8+
@NEW_VERSION=$$(echo "$(VERSION)" | awk -F. '{printf "%d.%d.%d", $$1, $$2, $$3+1}') && \
9+
git tag "v$${NEW_VERSION}" && \
10+
echo "Tagged v$${NEW_VERSION}"
11+
12+
minor: ## Create a new minor release (x.Y+1.0)
13+
@NEW_VERSION=$$(echo "$(VERSION)" | awk -F. '{printf "%d.%d.0", $$1, $$2+1}') && \
14+
git tag "v$${NEW_VERSION}" && \
15+
echo "Tagged v$${NEW_VERSION}"
16+
17+
major: ## Create a new major release (X+1.0.0)
18+
@NEW_VERSION=$$(echo "$(VERSION)" | awk -F. '{printf "%d.0.0", $$1+1}') && \
19+
git tag "v$${NEW_VERSION}" && \
20+
echo "Tagged v$${NEW_VERSION}"
21+
22+
tag: ## Show latest tag
23+
@echo "Latest version: $(LATEST_TAG)"
24+

0 commit comments

Comments
 (0)