File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22set -euo pipefail
33unalias -a
44
5- current_script_dir=" $( cd " $( dirname " ${0} " ) " & > /dev/null && pwd ) "
6- project_root_dir=" $( dirname ${current_script_dir} ) "
7- version_file=${project_root_dir} /src/icoco/VERSION
5+ readonly current_script_dir=" $( cd " $( dirname " ${0} " ) " & > /dev/null && pwd ) "
6+ readonly project_root_dir=" $( dirname ${current_script_dir} ) "
7+ readonly version_file=${project_root_dir} /src/icoco/VERSION
88
99# #######################
1010# Cli
@@ -13,7 +13,7 @@ if (( $# != 1 )); then
1313 echo " ERROR: You must provide exactly 1 argument: version number as x.y.z"
1414 exit 1
1515fi
16- version_name=$1
16+ readonly version_name=$1
1717
1818# #######################
1919# Main
@@ -66,6 +66,10 @@ read -p "Do you want to push version '${version_name}' ? (yes/[no]) " answer
6666if [[ " ${answer} " == " y" * ]]; then
6767 git push origin
6868 git push origin ${version_name}
69+ else
70+ git reset --hard HEAD^
71+ git tag -d ${version_name}
72+ exit 0
6973fi
7074
7175# Publish on pypi
@@ -77,4 +81,7 @@ if [[ "${answer}" == "y"* ]]; then
7781 python3 -m pip install --upgrade build twine
7882 python3 -m build
7983 python3 -m twine upload --repository pypi dist/*
84+ else
85+ echo " You pushed a version tag but this version has not been published!"
86+ exit 1
8087fi
You can’t perform that action at this time.
0 commit comments