-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
33 lines (27 loc) · 1.07 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
SHELL=/bin/bash
.PHONY : ci
ci: check_version_mismatch
@crystal spec --fail-fast
.PHONY : check_version_mismatch
check_version_mismatch: shard.yml README.md
@diff -w -c <(grep version: README.md) <(grep ^version: shard.yml)
######################################################################
### versioning
VERSION=
CURRENT_VERSION=$(shell git tag -l | sort -V | tail -1 | sed -e 's/^v//')
GUESSED_VERSION=$(shell git tag -l | sort -V | tail -1 | sed -e 's/^v//' | awk 'BEGIN { FS="." } { $$3++; } { printf "%d.%d.%d", $$1, $$2, $$3 }')
.PHONY : version
version:
@if [ "$(VERSION)" = "" ]; then \
echo "ERROR: specify VERSION as bellow. (current: $(CURRENT_VERSION))";\
echo " make version VERSION=$(GUESSED_VERSION)";\
else \
sed -i -e 's/^version: .*/version: $(VERSION)/' shard.yml ;\
sed -i -e 's/^ version: [0-9]\+\.[0-9]\+\.[0-9]\+/ version: $(VERSION)/' README.md ;\
echo git commit -a -m "'$(COMMIT_MESSAGE)'" ;\
git commit -a -m 'version: $(VERSION)' ;\
git tag "v$(VERSION)" ;\
fi
.PHONY : bump
bump:
make version VERSION=$(GUESSED_VERSION) -s