chore: add prerelease script (#876)

* chore: add prerelease script

* Update prerelease.md

* Update prerelease.sh

* Update prerelease.sh

* chore: address review

* update instruction

* alias 'run version' to make it clear we're running docs version

* indicate that we are creating commit, not pull request

* update asciinema preview

* nits
This commit is contained in:
Endilie Yacop Sucipto 2018-08-02 01:10:11 +08:00 committed by GitHub
parent 42a96696a4
commit 3971f803bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 75 additions and 0 deletions

48
scripts/prerelease.sh Normal file
View file

@ -0,0 +1,48 @@
#!/bin/bash
DOCS_VERSION_COMMAND="run version"
echo "Select an option for release"
echo
select VERSION in patch minor major "Specific Version"
do
echo
if [[ $REPLY =~ ^[1-4]$ ]]; then
if [[ $REPLY == 4 ]]; then
read -p "Enter a specific version: " -r VERSION
echo
if [[ -z $REPLY ]]; then
VERSION=$REPLY
fi
fi
read -p "Create $VERSION commit - Are you sure ... (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ || -z $REPLY ]]; then
# bump version
yarn version --new-version $VERSION --no-git-tag-version
NEW_VERSION=$(node -p "require('./package.json').version")
# create new branch
git checkout -b $NEW_VERSION master
# cut docusaurus docs version
cd website && yarn $DOCS_VERSION_COMMAND $NEW_VERSION
# Create commit
git add .
git commit -m "v$NEW_VERSION"
git push origin $NEW_VERSION
echo "Finished"
else
echo Cancelled
fi
break
else
echo Invalid \"${REPLY}\"
echo "To continue, please enter one of the options (1-4):"
echo
fi
done