Skip to content

Commit

Permalink
[chore] refactor and clean up build system.
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
diasbruno committed Jun 10, 2017
1 parent 5aac4a4 commit 00ea6fe
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.version
.branch
examples/**/*-bundle.js
node_modules/
.idea/
Expand Down
26 changes: 16 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ NPM=$(shell which npm)
YARN=$(shell which yarn)
JQ=$(shell which jq)

REMOTE="[email protected]:reactjs/react-modal"

VERSION=$(shell jq ".version" package.json)

help: info
@echo
@echo "Current version: $(VERSION)"
@echo
@echo "List of commands:"
@echo
Expand All @@ -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

Expand Down Expand Up @@ -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 [email protected]: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]"
Expand Down

0 comments on commit 00ea6fe

Please sign in to comment.