From 00ea6fe2f4515f7b85c29f4f14348de0766f68f3 Mon Sep 17 00:00:00 2001 From: Bruno Dias Date: Fri, 9 Jun 2017 17:59:10 -0300 Subject: [PATCH] [chore] refactor and clean up build system. * added .version and .branch to .gitignore... this allow us to to write files once with new version, and now, the branch which the version will be released. when it finishes to publish, remove both files. * execute tests before publish was missing. * publish assets were not removed. --- .gitignore | 2 ++ Makefile | 26 ++++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index c863a029..08809883 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.version +.branch examples/**/*-bundle.js node_modules/ .idea/ diff --git a/Makefile b/Makefile index 81a94ab1..0d7250c7 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,13 @@ NPM=$(shell which npm) YARN=$(shell which yarn) JQ=$(shell which jq) +REMOTE="git@github.com:reactjs/react-modal" + VERSION=$(shell jq ".version" package.json) help: info + @echo + @echo "Current version: $(VERSION)" @echo @echo "List of commands:" @echo @@ -24,7 +28,6 @@ info: @echo npm version: `$(NPM) --version` "($(NPM))" @echo yarn version: `$(YARN) --version` "($(YARN))" @echo jq version: `$(JQ) --version` "($(JQ))" - @echo react-modal version: $(VERSION) deps: deps-project deps-docs @@ -59,30 +62,33 @@ build-docs: @rm -rf _book @gitbook build -g reactjs/react-modal -version: +.version: @echo "[Updating react-modal version]" @sh ./scripts/version $(VERSION) + @$(JQ) '.version' package.json | cut -d\" -f2 > .version + +.branch: + git branch | grep '^*' | awk '{ print $$2 }' > .branch release-commit: - @$(JQ) '.version' package.json | cut -d\" -f2 > .version git commit --allow-empty -m "Release v`cat .version`." - @rm .version git add . git commit --amend -m "`git log -1 --format=%s`" release-tag: - @$(JQ) '.version' package.json | cut -d\" -f2 > .version git tag "v`cat .version`" - @rm .version publish-version: release-commit release-tag @echo "[Publishing]" - @$(JQ) '.version' package.json | cut -d\" -f2 > .version - git push git@github.com:reactjs/react-modal "`git branch | grep '^*' | awk '{ print $$2 }'`" "v`cat .version`" + git push $(REMOTE) "`cat .branch`" "v`cat .version`" npm publish - @rm .version -publish: version deps-project build publish-version publish-finished +publish-finished: + @rm -rf .version .branch + +pre-publish: .branch .version deps-project tests-ci build + +publish: pre-publish publish-version publish-finished publish-docs: deps-docs build-docs @echo "[Publishing docs]"