-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
30 lines (26 loc) · 887 Bytes
/
Copy pathMakefile
File metadata and controls
30 lines (26 loc) · 887 Bytes
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
# release helpers
.PHONY: major minor patch release verify docs
NPM=npm
major:
minor:
patch:
@VERSION=$$($(NPM) ls | head -n1 | awk -F'[@ ]' '{ print $$3}') \
TAG=$$($(NPM) version --no-git-tag-version $@ | sed 's/v//g') \
&& git commit -i package*json -m "Bump from $$VERSION to $$TAG" \
&& git tag $$TAG
verify:
@PACKAGE=$$($(NPM) ls | head -n1 | awk '{ print $$1}') \
VERSION=$$(echo $$PACKAGE | awk -F'[@ ]' '{ print $$3 }') \
TAG=$$(git describe --tags --dirty 2> /dev/null || echo '-') \
&& if [ "$$VERSION" = "$$TAG" ]; \
then echo "Able to release $$PACKAGE"; \
else echo "Unable to release (package: $$VERSION != git: $$TAG)" && exit 1; \
fi \
&& echo $$PACKAGE \
&& $(NPM) pack --dry-run
release: verify;
@echo "Releasing as '$$($(NPM) whoami)'" \
&& git push && git push --tags
#&& npm publish . --access public
# docs:
# npm run docs