-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
45 lines (38 loc) · 929 Bytes
/
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
.PHONY: all
all: build
.PHONY: build
build:
stack build
.PHONY: install
install:
stack install
.PHONY: test
test: build
stack test
.PHONY: clean
clean:
stack clean
VERSION := $$(sed -n '/^version:/s/^.* *\([0-9][0-9.]*\).*$$/\1/p' qhs.cabal)
GIT_DIFF := $$(git diff --name-only)
.PHONY: bump
bump:
ifneq ($(shell git status --porcelain),)
$(error git workspace is dirty)
endif
ifneq ($(shell git rev-parse --abbrev-ref HEAD),master)
$(error current branch is not master)
endif
@printf "Bump up version in qhs.cabal. Press Enter to proceed: "
@read -n1
@[ "$(GIT_DIFF)" == "qhs.cabal" ] || { \
echo "Version is not updated or unrelated file is updated:"; \
[ -z "$(GIT_DIFF)" ] || printf " %s\n" $(GIT_DIFF); \
exit 1; \
}
git commit -am "bump up version to $(VERSION)"
git tag "v$(VERSION)"
git push origin master
git push origin "refs/tags/v$(VERSION)"
.PHONY: sdist
sdist:
stack sdist --tar-dir .