Skip to content

Commit

Permalink
[MINOR] improvement(release): update docs version when release (apach…
Browse files Browse the repository at this point in the history
…e#5090)

### 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
  • Loading branch information
mchades authored and mplmoknijb committed Nov 6, 2024
1 parent 779e33d commit d52abb9
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
26 changes: 18 additions & 8 deletions dev/release/release-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
Expand All @@ -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"
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions dev/release/release-tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 10 additions & 5 deletions dev/release/update-java-doc-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d52abb9

Please sign in to comment.