You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemds.apache.org by ja...@apache.org on 2021/10/26 18:28:38 UTC

[systemds] branch master updated: [MINOR] Add dry run to pypi upload script (#1423)

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

janardhan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/master by this push:
     new 8df051f  [MINOR] Add dry run to pypi upload script (#1423)
8df051f is described below

commit 8df051fedfd60c9613c6aa4158af0c1b89968f48
Author: Janardhan Pulivarthi <j1...@protonmail.com>
AuthorDate: Tue Oct 26 23:58:34 2021 +0530

    [MINOR] Add dry run to pypi upload script (#1423)
    
    * add release version changes after the release candidate approval
---
 dev/release/{pypi_upload.sh => pypi-upload.sh} | 46 +++++++++++++++++++++-----
 1 file changed, 38 insertions(+), 8 deletions(-)

diff --git a/dev/release/pypi_upload.sh b/dev/release/pypi-upload.sh
old mode 100644
new mode 100755
similarity index 58%
rename from dev/release/pypi_upload.sh
rename to dev/release/pypi-upload.sh
index bb8567e..2a0b9e8
--- a/dev/release/pypi_upload.sh
+++ b/dev/release/pypi-upload.sh
@@ -20,16 +20,31 @@
 #
 #-------------------------------------------------------------
 
+################################################################################
+##  File:  pypi-upload.sh
+##  Desc:  Upload python artifacts to pypi.org
+################################################################################
+
 SELF=$(cd $(dirname $0) && pwd)
 
-# Release info
-RELEASE_VERSION=2.1.0
-RELEASE_TAG=2.1.0-rc3
+dry_run_flag=0
+while getopts ":n" opt; do
+  case $opt in
+    n) dry_run_flag=1 ;;
+    \?) error "Invalid option: $OPTARG" ;;
+  esac
+done
+
+
+RELEASE_VERSION=
+RELEASE_TAG=
+read -p "RELEASE_VERSION : " RELEASE_VERSION
+read -p "RELEASE_TAG : " RELEASE_TAG
 
 BASE_DIR=$PWD # SystemDS top level folder
 
-# Checkout the voted commit and build the publish distribution
 git checkout $RELEASE_TAG
+printf "\n Checkout $RELEASE_TAG for building artifacts \n"
 
 mvn clean package -P distribution
 
@@ -37,7 +52,20 @@ cd $BASE_DIR/src/main/python
 
 # Steps:
 # 1. update systemds/project_info.py with the new version
-sed -i "s/$RELEASE_VERSION-SNAPSHOT/$RELEASE_VERSION/" systemds/project_info.py
+
+printf "\n ======== "
+printf "\nA release candidate (RC) after successful voting will be called Approved release version\n"
+printf "Is this RC voted and approved by PMC? [Yes/No]: \n"
+
+# case and select
+# Docs: https://www.gnu.org/software/bash/manual/bash.html#index-case
+select yn in "Yes" "No"; do
+  case $yn in
+      Yes ) sed -i "s/$RELEASE_VERSION-SNAPSHOT/$RELEASE_VERSION/" systemds/project_info.py; break ;;
+      No ) sed -i "s/$RELEASE_VERSION-SNAPSHOT/$RELEASE_TAG/" systemds/project_info.py; break ;;
+      * ) echo "Yes or No response is required.";;
+  esac
+done
 
 # 2. generate distribution archives
 python3 create_python_dist.py
@@ -57,10 +85,12 @@ python3 -m twine check dist/*
 # username: __token__ 
 # password: pypi-DU5y...
 
-# python -m twine upload --repository testpypi dist/*
+if [[ $dry_run_flag != 1 ]]; then
+  python twine upload dist/*
+else
+  python -m twine upload --repository testpypi dist/*
+fi
 
-# Production:
-# python twine upload dist/*
 
 cd $BASE_DIR