Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/haydn/json-api-store. An isomorphic JavaScript library that acts as an in memory data store for JSON API data. particlesystem.com/json-api-store
json-api
Something went wrong. Try again.
2.7 kB · 105 lines
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106#!/usr/bin/env bashif [ $(git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') != "master" ]; then echo >&2 "Looks like you're not on the master branch. Checkout master and run this script." exit 1fiif [[ -n $(git status --porcelain 2> /dev/null) ]]; then echo >&2 "Looks like you're in a dirty head state. Clean-up un-committed files before and run this script again." exit 1fiecho "$ git pull"git pullecho "$ npm install"npm installecho "$ npm test node && npm test browser"npm test node && npm test browserif [ $? -ne 0 ]; then echo >&2 "Looks like there are failing tests. Make sure all tests pass and run this script again." exit 1fiecho "$ eslint --quiet src"eslint --quiet srcif [ $? -ne 0 ]; then echo >&2 "Looks like there are linting errors. Make sure all errors are cleaned-up and run this script again." exit 1fiecho "Existing releases:"git tag -lread -p "Enter the version number for this release (eg '1.4.5'): " versionecho "Building docs..."npm run docsecho "Building dist..."npm run buildecho "Updating NPM and Bower manifests..."sed -i.bak -E "s/\"version\": \"[0-9]+\.[0-9]+\.[0-9]+\"/\"version\": \"$version\"/" package.jsonrm package.json.baksed -i.bak -E "s/\"version\": \"[0-9]+\.[0-9]+\.[0-9]+\"/\"version\": \"$version\"/" bower.jsonrm bower.json.bakread -p "Are you sure you want to release v$version? (yes/no) " confirmif [ $confirm != "yes" ]; then echo "Aborting." exit 0fiecho "$ git add ."git add .echo "$ git commit -a -m \"Release v$version.\""git commit -a -m "Release v$version."echo "$ git tag \"v$version\""git tag "v$version"echo "$ git push"git pushecho "$ git push --tags"git push --tagsecho "$ npm publish"npm publishecho "Updating the website..."tmpdir=$(mktemp -d "${TMPDIR:-/tmp}/release.XXXX")# Copy dist, docs & example to a temp dir.cp -R dist "$tmpdir/dist"cp -R docs "$tmpdir/docs"cp -R example "$tmpdir/example"# Checkout the GitHub pages branch.echo "$ git checkout gh-pages"git checkout gh-pages# Delete the current dist & example dirs.rm -r dist example# Copy across the new dist, docs & example dirs.cp -R "$tmpdir"/dist distcp -R "$tmpdir"/dist "releases/v$version"cp -R "$tmpdir"/docs "docs/v$version"cp -R "$tmpdir"/example example# Clean-up the temp dir.rm -r $tmpdir# Fix mentions of the version number.sed -i.bak -E "s/v[0-9]+\.[0-9]+\.[0-9]+/v$version/g" index.htmlrm index.html.bak# Add, commit & push.echo "$ git add ."git add .echo "$ git commit -a -m \"Release v$version.\""git commit -a -m "Release v$version."echo "$ git push"git pushgit checkout masterechoecho "Done. All that's left to do is add details to the release notes on GitHub."echo