Update release script to support branches
diff --git a/dev/release-build.sh b/dev/release-build.sh
index 283dccf..7967202 100755
--- a/dev/release-build.sh
+++ b/dev/release-build.sh
@@ -61,9 +61,9 @@
release-build.sh --release-prepare --releaseVersion="2.0.0" --developmentVersion="2.1.0-SNAPSHOT"
release-build.sh --release-prepare --releaseVersion="2.0.0" --developmentVersion="2.1.0-SNAPSHOT" --releaseRc="rc1" --tag="v2.0.0"
+release-build.sh --release-prepare --releaseVersion="2.0.0" --developmentVersion="2.1.0-SNAPSHOT" --releaseRc="rc1" --gitBranch="branch-2.0" --tag="v2.0.0"
release-build.sh --release-prepare --releaseVersion="2.0.0" --developmentVersion="2.1.0-SNAPSHOT" --releaseRc="rc1" --tag="v2.0.0" --gitCommitHash="a874b73" --dryRun
-release-build.sh --release-publish --gitCommitHash="a874b73"
release-build.sh --release-publish --gitTag="v2.0.0rc1"
release-build.sh --release-snapshot
@@ -103,6 +103,10 @@
GIT_REF="${PARTS[1]}"
shift
;;
+ --gitBranch)
+ GIT_BRANCH="${PARTS[1]}"
+ shift
+ ;;
--gitTag)
GIT_TAG="${PARTS[1]}"
shift
@@ -160,15 +164,23 @@
exit_with_usage
fi
+if [[ "$RELEASE_PREPARE" == "true" ]]; then
+ if [[ "$GIT_REF" && "$GIT_BRANCH" ]]; then
+ echo "ERROR: Only one argument permitted when publishing : --gitCommitHash or --gitBranch"
+ exit_with_usage
+ fi
+fi
+
if [[ "$RELEASE_PUBLISH" == "true" ]]; then
- if [[ "$GIT_REF" && "$GIT_TAG" ]]; then
- echo "ERROR: Only one argumented permitted when publishing : --gitCommitHash or --gitTag"
+ if [[ -z "$GIT_TAG" ]]; then
+ echo "ERROR: --gitTag must be passed as an argument to run this script"
exit_with_usage
fi
- if [[ -z "$GIT_REF" && -z "$GIT_TAG" ]]; then
- echo "ERROR: --gitCommitHash OR --gitTag must be passed as an argument to run this script"
- exit_with_usage
- fi
+fi
+
+if [[ "$RELEASE_PUBLISH" == "true" && "$GIT_REF" ]]; then
+ echo "ERROR: --gitCommitHash not supported for --release-publish"
+ exit_with_usage
fi
if [[ "$RELEASE_PUBLISH" == "true" && "$DRY_RUN" ]]; then
@@ -183,6 +195,9 @@
# Commit ref to checkout when building
GIT_REF=${GIT_REF:-master}
+if [[ "$RELEASE_PREPARE" == "true" && "$GIT_BRANCH" ]]; then
+ GIT_REF="origin/$GIT_BRANCH"
+fi
if [[ "$RELEASE_PUBLISH" == "true" && "$GIT_TAG" ]]; then
GIT_REF="tags/$GIT_TAG"
fi
@@ -209,6 +224,7 @@
echo "-------------------------------------------------------------"
echo "Executing ==> $GOAL"
echo "Git reference ==> $GIT_REF"
+echo "Git branch ==> $GIT_BRANCH"
echo "release version ==> $RELEASE_VERSION"
echo "development version ==> $DEVELOPMENT_VERSION"
echo "rc ==> $RELEASE_RC"
@@ -229,7 +245,12 @@
rm -rf bahir
git clone https://git-wip-us.apache.org/repos/asf/bahir.git
cd bahir
- git checkout $GIT_REF
+ if [[ "$GIT_BRANCH" ]]; then
+ git checkout --track $GIT_REF
+ else
+ git checkout $GIT_REF
+ fi
+
git_hash=`git rev-parse --short HEAD`
echo "Checked out Bahir git hash $git_hash"