Pass already bumped version to prepare-release.sh
Summary: The script now receives new version via command line. Reviewed By: jknoxville Differential Revision: D24771302 fbshipit-source-id: 243ad2cc8cb62af86eadb44fbf4bd7c71e97af6f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ce5783f14d
commit
d8b3ac3e54
@@ -6,58 +6,14 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
darwin=false
|
|
||||||
facebook=false
|
|
||||||
case "$(uname)" in
|
|
||||||
Darwin*) darwin=true ;;
|
|
||||||
esac
|
|
||||||
case "$(hostname -f)" in
|
|
||||||
*.facebook.com) facebook=true
|
|
||||||
esac
|
|
||||||
|
|
||||||
nodejs="/usr/bin/env node"
|
|
||||||
if [[ $facebook == true ]]; then
|
|
||||||
nodejs="$(hg root)/xplat/third-party/node/bin/node"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! jq --version > /dev/null; then
|
|
||||||
if $darwin; then
|
|
||||||
echo -e "jq is not installed! Should the script install it for you? (y/n) \\c"
|
|
||||||
read -r REPLY
|
|
||||||
if [ "$REPLY" = "y" ]; then
|
|
||||||
brew install jq
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo >&2 "jq is not installed. Please install it using your platform's package manager (apt-get, yum, pacman, etc.)."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Checking for any uncommitted changes..."
|
|
||||||
CHANGES=$(hg st)
|
|
||||||
echo "$CHANGES"
|
|
||||||
|
|
||||||
if [ ! -z "$CHANGES" ];
|
|
||||||
then
|
|
||||||
echo "There are uncommitted changes, either commit or revert them."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "✨ Making a new release..."
|
echo "✨ Making a new release..."
|
||||||
|
|
||||||
# When starting this job from SandcastleFlipperAutoReleaseCommand, we pass in the revision to release
|
# When starting this job from SandcastleFlipperAutoReleaseCommand, we pass in the revision to release
|
||||||
SANDCASTLE_REVISION="$1"
|
SANDCASTLE_REVISION="$1"
|
||||||
# Either 'patch', 'minor', or 'major'
|
VERSION="$2"
|
||||||
VERSION_PART="${2:-minor}"
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
SONAR_DIR="$DIR/../"
|
SONAR_DIR="$DIR/../"
|
||||||
DESKTOP_DIR="$SONAR_DIR/desktop"
|
DESKTOP_DIR="$SONAR_DIR/desktop"
|
||||||
FLIPPER_PODSPEC_PATH="$SONAR_DIR/Flipper.podspec"
|
|
||||||
FLIPPERKIT_VERSION_TAG='flipperkit_version'
|
|
||||||
OLD_VERSION_POD_ARG=$(< "$FLIPPER_PODSPEC_PATH" grep "$FLIPPERKIT_VERSION_TAG =" )
|
|
||||||
OLD_VERSION="${OLD_VERSION_POD_ARG##* }"
|
|
||||||
|
|
||||||
source "$DIR"/setup-env.sh
|
source "$DIR"/setup-env.sh
|
||||||
|
|
||||||
@@ -66,14 +22,12 @@ if [[ ! -d "$DESKTOP_DIR/node_modules" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# if we got called with a rev argument, we got triggered from our automatic sandcastle job
|
# if we got called with a rev argument, we got triggered from our automatic sandcastle job
|
||||||
if [ "$SANDCASTLE_REVISION" != "" ];
|
if [ "$SANDCASTLE_REVISION" == "" ];
|
||||||
then
|
then
|
||||||
echo "Automatically bumping version to next $VERSION_PART version in package.json"
|
OLD_VERSION=$(jq -r '.version' "$DESKTOP_DIR"/package.json)
|
||||||
npm -C "$DESKTOP_DIR" version "$VERSION_PART"
|
|
||||||
VERSION=$(jq -r '.version' "$DESKTOP_DIR"/package.json)
|
|
||||||
else
|
|
||||||
echo "The currently released version is $OLD_VERSION. What should the version of the next release be?"
|
echo "The currently released version is $OLD_VERSION. What should the version of the next release be?"
|
||||||
read -r VERSION
|
read -r VERSION
|
||||||
|
yarn --cwd "$DESKTOP_DIR" version --new-version "$VERSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Preparing release $VERSION..."
|
echo "Preparing release $VERSION..."
|
||||||
@@ -123,7 +77,7 @@ Reviewers: flipper\n\n\
|
|||||||
Tags: accept2ship"
|
Tags: accept2ship"
|
||||||
)"
|
)"
|
||||||
|
|
||||||
if [ "$SANDCASTLE_REVISION" == "" ];
|
if [ "$SANDCASTLE_REVISION" == "" ];
|
||||||
then
|
then
|
||||||
# Submit diffs, we only do this when running locally.
|
# Submit diffs, we only do this when running locally.
|
||||||
# From SandcastleFlipperAutoReleaseCommand, the diffs are submitted
|
# From SandcastleFlipperAutoReleaseCommand, the diffs are submitted
|
||||||
|
|||||||
Reference in New Issue
Block a user