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

chengpan pushed a commit to branch branch-0.3
in repository https://gitbox.apache.org/repos/asf/kyuubi-shaded.git


The following commit(s) were added to refs/heads/branch-0.3 by this push:
     new b44e8d9  [KYUUBI-SHADED #43] Enhance release scripts
b44e8d9 is described below

commit b44e8d930d404f28c9fafb7831d53c84794ba34a
Author: Cheng Pan <[email protected]>
AuthorDate: Mon Mar 4 21:21:33 2024 +0800

    [KYUUBI-SHADED #43] Enhance release scripts
    
    ### _Why are the changes needed?_
    
    This PR backports the following release script enhancement from 
apache/kyuubi repo.
    
    - https://github.com/apache/kyuubi/pull/5308
    - https://github.com/apache/kyuubi/pull/6061
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [ ] [Run 
test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests)
 locally before make a pull request
    
    Closes #43 from pan3793/release-script.
    
    f3a0a7a [Cheng Pan] Enhance releasing scripts
    
    Authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit 87dcbc4ac8426cb1b937fc32cab4044b0e1fb6c8)
    Signed-off-by: Cheng Pan <[email protected]>
---
 build/release/release.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/build/release/release.sh b/build/release/release.sh
index 40965ce..f377efd 100755
--- a/build/release/release.sh
+++ b/build/release/release.sh
@@ -52,6 +52,21 @@ if [[ ${RELEASE_VERSION} =~ .*-SNAPSHOT ]]; then
   exit 1
 fi
 
+if [ -n "${JAVA_HOME}" ]; then
+  JAVA="${JAVA_HOME}/bin/java"
+elif [ "$(command -v java)" ]; then
+  JAVA="java"
+else
+  echo "JAVA_HOME is not set" >&2
+  exit 1
+fi
+
+JAVA_VERSION=$($JAVA -version 2>&1 | awk -F '"' '/version/ {print $2}')
+if [[ $JAVA_VERSION != 1.8.* ]]; then
+  echo "Unexpected Java version: $JAVA_VERSION. Java 8 is required for 
release."
+  exit 1
+fi
+
 RELEASE_TAG="v${RELEASE_VERSION}-rc${RELEASE_RC_NO}"
 
 SVN_STAGING_REPO="https://dist.apache.org/repos/dist/dev/kyuubi";
@@ -67,6 +82,7 @@ package() {
 }
 
 upload_svn_staging() {
+  rm -rf "${SVN_STAGING_DIR}"
   svn checkout --depth=empty "${SVN_STAGING_REPO}" "${SVN_STAGING_DIR}"
   mkdir -p "${SVN_STAGING_DIR}/kyuubi-shaded-${RELEASE_TAG}"
   rm -f "${SVN_STAGING_DIR}/kyuubi-shaded-${RELEASE_TAG}/*"

Reply via email to