-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (45 loc) · 2.26 KB
/
Makefile
File metadata and controls
52 lines (45 loc) · 2.26 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
.PHONY: bump-major bump-minor bump-patch bump-date git-push help
# Get the latest git tag and its version components
CURRENT_VERSION=$(shell git describe --tags --abbrev=0)
MAJOR=$(shell echo $(CURRENT_VERSION) | cut -d. -f1)
MINOR=$(shell echo $(CURRENT_VERSION) | cut -d. -f2)
PATCH=$(shell echo $(CURRENT_VERSION) | cut -d. -f3 | cut -d- -f1)
NEW_DATE=$(shell date "+%y%m%d%H%M%S")
help:
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@echo " bump-major: Bump the major version"
@echo " bump-minor: Bump the minor version"
@echo " bump-patch: Bump the patch version"
@echo " bump-date: Bump the date"
@echo " git-push: Push the current branch and tags"
@echo " help: Show this help"
# Version bumping
bump-major:
$(eval NEW_MAJOR=$(shell echo $$(( $(MAJOR) + 1 )) ))
@echo "Bumping major version..."
git tag -f -a $(NEW_MAJOR).0.0 -m "Bump major version to $(NEW_MAJOR).0.0 build $(NEW_DATE)"
git tag -a $(NEW_MAJOR).0.0-$(NEW_DATE) -m "Bump major version to $(NEW_MAJOR).0.0 build $(NEW_DATE)"
@echo To push this tag execute :
@echo git push origin $(NEW_MAJOR).0.0-$(NEW_DATE)
bump-minor:
$(eval NEW_MINOR=$(shell echo $$(( $(MINOR) + 1 )) ))
@echo "Bumping minor version..."
git tag -f -a $(MAJOR).$(NEW_MINOR).0 -m "Bump minor version to $(MAJOR).$(NEW_MINOR).0 build $(NEW_DATE)"
git tag -a $(MAJOR).$(NEW_MINOR).0-$(NEW_DATE) -m "Bump minor version to $(MAJOR).$(NEW_MINOR).0 build $(NEW_DATE)"
@echo To push this tag execute :
@echo git push origin $(MAJOR).$(NEW_MINOR).0-$(NEW_DATE)
bump-patch:
$(eval NEW_PATCH=$(shell echo $$(( $(PATCH) + 1 )) ))
@echo "Bumping patch version..."
git tag -f -a $(MAJOR).$(MINOR).$(NEW_PATCH) -m "Bump patch version to $(MAJOR).$(MINOR).$(NEW_PATCH) build $(NEW_DATE)"
git tag -a $(MAJOR).$(MINOR).$(NEW_PATCH)-$(NEW_DATE) -m "Bump patch version to $(MAJOR).$(MINOR).$(NEW_PATCH) build $(NEW_DATE)"
@echo To push this tag execute :
@echo git push origin $(MAJOR).$(MINOR).$(NEW_PATCH)-$(NEW_DATE)
bump-date:
@echo "Bumping date version..."
git tag -a $(MAJOR).$(MINOR).$(PATCH) -m "Bump patch version to $(MAJOR).$(MINOR).$(NEW_PATCH) build $(NEW_DATE)"
git tag -a $(MAJOR).$(MINOR).$(PATCH)-$(NEW_DATE) -m "Bump patch version to $(MAJOR).$(MINOR).$(NEW_PATCH) build $(NEW_DATE)"
git-push:
git push && git push --tags