This repository was archived by the owner on Jul 12, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
37 lines (33 loc) · 1.57 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
.PHONY: build default release
VERSION := $(shell node -e "console.log(require('./package.json').version)")
BOLD := $(shell tput bold)
RED := $(shell tput setaf 1)
RESET := $(shell tput sgr0)
build:
@echo "Did you mean 'make release' ?"
default:
@echo "Did you mean 'make release' ?"
release:
@if [ $(NODE_PRE_GYP_GITHUB_TOKEN) = "" ]; then echo "$(RED)Please specify a $(BOLD)NODE_PRE_GYP_GITHUB_TOKEN$(RESET)"; echo ""; exit 1; fi
@echo "Current Version: $(BOLD)$(VERSION)$(RESET)"
@if [ "$(TAG)" = "" ]; then echo "$(BOLD)$(RED)Please specify a new version$(RESET)"; fi
@if [ "$(TAG)" = "" ]; then echo "$(BOLD)TAG=$(VERSION)1 make release$(RESET)"; echo ""; exit 1; fi
@if [ "$(TAG)" = $(VERSION) ]; then echo "$(BOLD)$(RED)Please specify a different version$(RESET)"; echo ""; exit 1; fi
@echo "Creating Release: $(BOLD)$(TAG)$(RESET)"
@echo ""
@node -e "var pkg=require('./package.json');pkg.version='$(TAG)';pkg.binary.host=pkg.binary.host.replace(/\/\d+\.\d+\.\d+\$$/,'/$(TAG)');require('fs').writeFileSync('./package.json', JSON.stringify(pkg,null,' '));"
@echo "Building Package"
./node_modules/node-pre-gyp/bin/node-pre-gyp configure
./node_modules/node-pre-gyp/bin/node-pre-gyp rebuild
node-pre-gyp-github package
@echo "Adding updated package.json"
@git add .
@git commit -m "Release $(TAG)"
@git push
@echo "Tagging master Release $(BOLD)$(TAG)$(RESET)"
@git tag -m "Release $(TAG)" $(TAG)
@echo "Pushing master tags to GitHub"
@git push --tags
NODE_PRE_GYP_GITHUB_TOKEN="$(NODE_PRE_GYP_GITHUB_TOKEN)" node-pre-gyp-github publish
@echo "Publishing to npm"
npm publish