#!/bin/bash

# fail if err occurs on any step
set -o errexit

### set the version
echo "What is the release version you want to use [ex: 1.0.4], followed by [ENTER]:"
read VERSION

if [ "$VERSION" ]
  then
    git co master
    git pull
    git co -b release_v$VERSION
    npm run build:release
    npm version $VERSION
  else
    echo "You didn't do it right."
fi

open CHANGELOG.md
read -p "Please amend the CHANGELOG (now opened), and hit [ENTER] when complete:"

echo "Pushing files"
git add --all
git commit -m"CHANGELOG for $VERSION"
git push origin release_v$VERSION

echo "Send this link for review: https://github.com/GetAmbassador/react-ions/blob/release_v$VERSION/CHANGELOG.md"
echo "-------"
echo "Complete the merge here: https://github.com/GetAmbassador/react-ions/tree/release_v$VERSION"
