-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
40 lines (33 loc) · 836 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
.PHONY: all
all: build
.PHONY: build
build:
cargo build
.PHONY: install
install:
cargo install --path .
.PHONY: test
test: build
cargo test
.PHONY: clean
clean:
cargo clean
VERSION := $$(sed -n '/^version =/s/^.* *"\([0-9][0-9.]*\)".*$$/\1/p' Cargo.toml)
GIT_DIFF := $$(git diff --name-only)
.PHONY: bump
bump:
test -z "$$(git status --porcelain || echo .)"
test "$$(git branch --show-current)" = "main"
@printf "Bump up version in Cargo.toml. Press Enter to proceed: "
@read -n1
@[ "$(GIT_DIFF)" == "Cargo.toml" ] || { \
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 --atomic origin main tag "v$(VERSION)"
.PHONY: publish
publish:
cargo publish