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

jshao pushed a commit to branch branch-0.7
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/branch-0.7 by this push:
     new 9d263bfc3 [MINOR] improvement(release): update docs version when 
release (#5285)
9d263bfc3 is described below

commit 9d263bfc31bfbfa663ac5e8d3360c796ea6fd07b
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Oct 28 13:58:45 2024 +0800

    [MINOR] improvement(release): update docs version when release (#5285)
    
    ### What changes were proposed in this pull request?
    
     - remove upload Python packages to RELEASE_STAGING
     - update the docs version when preparing release
    
    ### Why are the changes needed?
    
    improve the release script
    
    ### Does this PR introduce _any_ user-facing change?
    no
    
    ### How was this patch tested?
    
    by hand
    
    Co-authored-by: mchades <[email protected]>
---
 dev/release/release-build.sh           | 26 ++++++++++++++++++--------
 dev/release/release-tag.sh             |  3 +++
 dev/release/update-java-doc-version.sh | 15 ++++++++++-----
 3 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/dev/release/release-build.sh b/dev/release/release-build.sh
index a66b338dd..732711197 100755
--- a/dev/release/release-build.sh
+++ b/dev/release/release-build.sh
@@ -96,6 +96,9 @@ BASE_DIR=$(pwd)
 init_java
 init_gradle
 
+function uriencode { jq -nSRr --arg v "$1" '$v|@uri'; }
+declare -r ENCODED_ASF_PASSWORD=$(uriencode "$ASF_PASSWORD")
+
 if [[ "$1" == "finalize" ]]; then
   if [[ -z "$PYPI_API_TOKEN" ]]; then
     error 'The environment variable PYPI_API_TOKEN is not set. Exiting.'
@@ -110,7 +113,7 @@ if [[ "$1" == "finalize" ]]; then
     echo "v$RELEASE_VERSION already exists. Skip creating it."
   else
     rm -rf gravitino
-    git clone "https://$ASF_USERNAME:$ASF_PASSWORD@$ASF_GRAVITINO_REPO"; -b main
+    git clone 
"https://$ASF_USERNAME:$ENCODED_ASF_PASSWORD@$ASF_GRAVITINO_REPO"; -b main
     cd gravitino
     git tag "v$RELEASE_VERSION" "$RELEASE_TAG"
     git push origin "v$RELEASE_VERSION"
@@ -119,19 +122,20 @@ if [[ "$1" == "finalize" ]]; then
     echo "git tag v$RELEASE_VERSION created"
   fi
 
-  # download Gravitino Python binary from the dev directory and upload to PyPi.
+  # upload to PyPi.
+  # todo: uncomment below codes if possible, it will download Gravitino Python 
binary from the dev directory
   echo "Uploading Gravitino to PyPi"
-  svn co --depth=empty "$RELEASE_STAGING_LOCATION/$RELEASE_TAG" svn-gravitino
-  cd svn-gravitino
+  # svn co --depth=empty "$RELEASE_STAGING_LOCATION/$RELEASE_TAG" svn-gravitino
+  # cd svn-gravitino
   PYGRAVITINO_VERSION=`echo "$RELEASE_VERSION" |  sed -e "s/-/./" -e 
"s/preview/dev/"`
-  svn update "apache_gravitino-$PYGRAVITINO_VERSION.tar.gz"
-  svn update "apache_gravitino-$PYGRAVITINO_VERSION.tar.gz.asc"
+  # svn update "apache_gravitino-$PYGRAVITINO_VERSION.tar.gz"
+  # svn update "apache_gravitino-$PYGRAVITINO_VERSION.tar.gz.asc"
   twine upload -u __token__  -p $PYPI_API_TOKEN \
     --repository-url https://upload.pypi.org/legacy/ \
     "apache_gravitino-$PYGRAVITINO_VERSION.tar.gz" \
     "apache_gravitino-$PYGRAVITINO_VERSION.tar.gz.asc"
-  cd ..
-  rm -rf svn-gravitino
+  # cd ..
+  # rm -rf svn-gravitino
   echo "Python Gravitino package uploaded"
 
   # Moves the binaries from dev directory to release directory.
@@ -252,6 +256,12 @@ if [[ "$1" == "package" ]]; then
     echo "Copying release tarballs"
     cp gravitino-* "svn-gravitino/${DEST_DIR_NAME}/"
     cp apache_gravitino-* "svn-gravitino/${DEST_DIR_NAME}/"
+    # remove python client tarball
+    # todo: remove this when python version supports include '-incubating' or 
the project is graduated
+    rm 
"svn-gravitino/${DEST_DIR_NAME}/apache_gravitino-$PYGRAVITINO_VERSION.tar.gz"
+    rm 
"svn-gravitino/${DEST_DIR_NAME}/apache_gravitino-$PYGRAVITINO_VERSION.tar.gz.asc"
+    rm 
"svn-gravitino/${DEST_DIR_NAME}/apache_gravitino-$PYGRAVITINO_VERSION.tar.gz.sha512"
+
     svn add "svn-gravitino/${DEST_DIR_NAME}"
 
     cd svn-gravitino
diff --git a/dev/release/release-tag.sh b/dev/release/release-tag.sh
index 98fc8db85..112ab8353 100755
--- a/dev/release/release-tag.sh
+++ b/dev/release/release-tag.sh
@@ -83,6 +83,9 @@ PYGRAVITINO_NEXT_VERSION=$(echo $NEXT_VERSION | sed 
's/-incubating-SNAPSHOT/.dev
 sed -i".tmp1" 's/version = .*$/version = '"$RELEASE_VERSION"'/g' 
gradle.properties
 sed -i".tmp2" 's/    version=.*$/    
version="'"$PYGRAVITINO_RELEASE_VERSION"'",/g' clients/client-python/setup.py
 
+# update docs version
+"$SELF/update-java-doc-version.sh" "$RELEASE_VERSION" "$SELF/gravitino"
+
 git commit -a -m "Preparing Gravitino release $RELEASE_TAG"
 echo "Creating tag $RELEASE_TAG at the head of $GIT_BRANCH"
 git tag $RELEASE_TAG
diff --git a/dev/release/update-java-doc-version.sh 
b/dev/release/update-java-doc-version.sh
index 13a29c37d..4085ad8ab 100755
--- a/dev/release/update-java-doc-version.sh
+++ b/dev/release/update-java-doc-version.sh
@@ -20,27 +20,32 @@
 
 set -e
 
-if [[ $# -ne 1 ]]; then
-  echo "Usage: $0 <new_version>"
+if [[ $# -lt 1 || $# -gt 2 ]]; then
+  echo "Usage: $0 <new_version> [project_dir]"
   exit 1
 fi
 
 NEW_VERSION=$1
-cd "$(cd "$(dirname "$0")" && pwd)/../../docs"
+PROJECT_DIR=${2:-$(cd "$(dirname "$0")" && pwd)/../../}
+cd "${PROJECT_DIR}/docs"
 CURRENT_VERSION=`cat index.md| grep pathname:///docs | head -n 1 | awk -F 
'///docs' '{print $2}' | awk -F '/' '{print $2}'`
 
 if [[ "${NEW_VERSION}" == "${CURRENT_VERSION}" ]]; then
-  echo "The new version is the same as the current version."
-  exit 1
+  echo "The new version is the same as the current version: ${NEW_VERSION}"
+  exit 0
 fi
 
 # Detect the operating system
 if [[ "$OSTYPE" == "darwin"* ]]; then
     # macOS
     find "$(pwd)" -name "*.md" | xargs sed -i '' 
"s|/docs/${CURRENT_VERSION}/api|/docs/${NEW_VERSION}/api|g"
+    # modify open-api/openapi.yaml
+    sed -i '' "s|version: ${CURRENT_VERSION}|version: ${NEW_VERSION}|g" 
open-api/openapi.yaml
 elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
     # Linux
     find "$(pwd)" -name "*.md" | xargs sed -i 
"s|/docs/${CURRENT_VERSION}/api|/docs/${NEW_VERSION}/api|g"
+    # modify open-api/openapi.yaml
+    sed -i "s|version: ${CURRENT_VERSION}|version: ${NEW_VERSION}|g" 
open-api/openapi.yaml
 else
     echo "Unsupported OS"
     exit 1

Reply via email to