#!/bin/bash

if  [ "$1" = "" ] ; then
    echo "Please supply a new version."
    exit
fi

git checkout master &&
git pull upstream master &&
git reset --hard upstream/master &&
npm version --no-git-tag-version $1 &&
npm install &&
git add package.json package-lock.json &&
git commit -m "Publish version $1" &&
git tag $1 &&
git push upstream master &&
git push upstream $1