-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
63 lines (54 loc) · 1.3 KB
/
Makefile
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
NAME=hermes
BIN ?= bin/hermes
.PHONY: build
## build: Build hermes
build:
go build -o ${BIN} cmd/server/**.go
.PHONY: clean
## clean: Clean projects and previous builds
clean:
@rm -rf $(NAME)
.PHONY: deps
## deps: Download modules
deps:
@go mod download
.PHONY: major
## major: Create a major release
major:
@git pull --tags; \
IFS='.' read -ra tag <<< "$$(git describe --tags `git rev-list --tags --max-count=1`)"; \
bump=$$(($${tag[0]:1} + 1)); \
ver=v$$bump.0.0; \
rem=$$(git remote); \
git tag $$ver; \
git push $$rem $$ver
.PHONY: minor
## minor: Create a minor release
minor:
@git pull --tags; \
IFS='.' read -ra tag <<< "$$(git describe --tags `git rev-list --tags --max-count=1`)"; \
bump=$$(($${tag[1]} + 1)); \
ver=$${tag[0]}.$$bump.0; \
rem=$$(git remote); \
git tag $$ver; \
git push $$rem $$ver
.PHONY: patch
## patch: Create a patch
patch:
@git pull --tags; \
IFS='.' read -ra tag <<< "$$(git describe --tags `git rev-list --tags --max-count=1`)"; \
bump=$$(($${tag[2]} + 1)); \
ver=$${tag[0]}.$${tag[1]}.$$bump; \
rem=$$(git remote); \
git tag $$ver; \
git push $$rem $$ver
.PHONY: help
all: help
## help: show this help message
help: makefile
@echo
@echo " Choose a command to run:"
@echo
@sed -n 's/^##//p' $< | column -t -s ':' | sed -e 's/^/ /'
@echo
.DEFAULT_GOAL := help