You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bahir.apache.org by lr...@apache.org on 2019/05/19 14:54:31 UTC

[bahir] branch branch-2.2 updated: Update release script to support branches

This is an automated email from the ASF dual-hosted git repository.

lresende pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/bahir.git


The following commit(s) were added to refs/heads/branch-2.2 by this push:
     new 76614e8  Update release script to support branches
76614e8 is described below

commit 76614e83c632366b2868e25798746f8891f8b9cf
Author: Luciano Resende <lr...@apache.org>
AuthorDate: Sun May 19 16:54:14 2019 +0200

    Update release script to support branches
---
 dev/release-build.sh | 35 ++++++++++++++++++++++++++++-------
 1 file changed, 28 insertions(+), 7 deletions(-)

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 @@ EXAMPLES
 
 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 @@ while [ "${1+defined}" ]; do
       GIT_REF="${PARTS[1]}"
       shift
       ;;
+    --gitBranch)
+      GIT_BRANCH="${PARTS[1]}"
+      shift
+      ;;
     --gitTag)
       GIT_TAG="${PARTS[1]}"
       shift
@@ -160,17 +164,25 @@ if [[ "$RELEASE_PREPARE" == "true" && -z "$DEVELOPMENT_VERSION" ]]; then
     exit_with_usage
 fi
 
-if [[ "$RELEASE_PUBLISH" == "true"  ]]; then
-    if [[ "$GIT_REF" && "$GIT_TAG" ]]; then
-        echo "ERROR: Only one argumented permitted when publishing : --gitCommitHash or --gitTag"
+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
-    if [[ -z "$GIT_REF" && -z "$GIT_TAG" ]]; then
-        echo "ERROR: --gitCommitHash OR --gitTag must be passed as an argument to run this script"
+fi
+
+if [[ "$RELEASE_PUBLISH" == "true"  ]]; then
+    if [[ -z "$GIT_TAG" ]]; then
+        echo "ERROR: --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
     echo "ERROR: --dryRun not supported for --release-publish"
     exit_with_usage
@@ -183,6 +195,9 @@ fi
 
 # 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 "------- Release preparation with the following parameters ---"
 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 @@ function checkout_code {
     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"