docusaurus/scripts/prerelease.sh

56 lines
1.4 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
##
# Copyright (c) 2017-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
2019-04-10 09:10:19 -04:00
DOCS_VERSION_COMMAND="run docusaurus-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
2019-03-24 00:53:32 -04:00
cd packages/docusaurus-1.x
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
2019-03-30 11:00:02 -04:00
cd ../../website-1.x && yarn $DOCS_VERSION_COMMAND $NEW_VERSION
# Create commit
git add ../
git commit -m "v$NEW_VERSION"
git push -f 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