-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
93 lines (70 loc) · 2.29 KB
/
Copy pathMakefile
File metadata and controls
93 lines (70 loc) · 2.29 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
MAKE := make --no-print-directory
DESCRIBE := $(shell git describe --always --tags)
DESCRIBE_PARTS := $(subst -, ,$(DESCRIBE))
VERSION_TAG := $(word 1,$(DESCRIBE_PARTS))
COMMITS_SINCE_TAG := $(word 2,$(DESCRIBE_PARTS))
VERSION := $(subst v,,$(VERSION_TAG))
VERSION_PARTS := $(subst ., ,$(VERSION))
MAJOR := $(word 1,$(VERSION_PARTS))
MINOR := $(word 2,$(VERSION_PARTS))
MICRO := $(word 3,$(VERSION_PARTS))
NEXT_MAJOR := $(shell echo $$(($(MAJOR)+1)))
NEXT_MINOR := $(shell echo $$(($(MINOR)+1)))
NEXT_MICRO := $(shell echo $$(($(MICRO)+1)))
CURRENT_VERSION_MICRO := $(MAJOR).$(MINOR).$(NEXT_MICRO)
CURRENT_VERSION_MINOR := $(MAJOR).$(NEXT_MINOR).0
CURRENT_VERSION_MAJOR := $(NEXT_MAJOR).0.0
DATE = $(shell date +'%d.%m.%Y')
TIME = $(shell date +'%H:%M:%S')
COMMIT := $(shell git rev-parse HEAD)
AUTHOR := $(firstword $(subst @, ,$(shell git show --format="%aE" $(COMMIT))))
BRANCH_NAME := $(shell git rev-parse --abbrev-ref HEAD)
TAG_MESSAGE = "$(TIME) $(DATE) $(AUTHOR) $(BRANCH_NAME)"
COMMIT_MESSAGE := $(shell git log --format=%B -n 1 $(COMMIT))
CURRENT_TAG_MICRO := "$(CURRENT_VERSION_MICRO)"
CURRENT_TAG_MINOR := "$(CURRENT_VERSION_MINOR)"
CURRENT_TAG_MAJOR := "$(CURRENT_VERSION_MAJOR)"
# --- Version commands ---
.PHONY: version
version:
@$(MAKE) version-micro
.PHONY: version-micro
version-micro:
@echo "$(CURRENT_VERSION_MICRO)"
.PHONY: version-minor
version-minor:
@echo "$(CURRENT_VERSION_MINOR)"
.PHONY: version-major
version-major:
@echo "$(CURRENT_VERSION_MAJOR)"
# --- Tag commands ---
.PHONY: tag-micro
tag-micro:
@echo "$(CURRENT_TAG_MICRO)"
.PHONY: tag-minor
tag-minor:
@echo "$(CURRENT_TAG_MINOR)"
.PHONY: tag-major
tag-major:
@echo "$(CURRENT_TAG_MAJOR)"
# -- Meta info ---
.PHONY: tag-message
tag-message:
@echo "$(TAG_MESSAGE)"
.PHONY: commit-message
commit-message:
@echo "$(COMMIT_MESSAGE)"
# -- Documentation ---
documentation:
git checkout gh-pages
git pull origin gh-pages
jazzy
rm -rf ./build
git add -A
git commit -m "Regenerated docs"
git push origin gh-pages
# -- Update Git tag ---
update-minor:
git checkout master
git tag "$(CURRENT_VERSION_MICRO)"
git push origin master --tags