bits/publish.sh

65 lines
1.6 KiB
Bash
Raw Normal View History

2020-11-18 22:56:22 -06:00
#!/bin/sh -
_FALSE=0
_TRUE=1
__ScriptName="publish.sh"
username="__token__"
test_token=`cat test.token`
pypi_token=`cat pypi.token`
2021-04-13 19:59:02 -05:00
#--------------------------------------------------------------------------------------------------
2020-11-18 22:56:22 -06:00
# Handle command line arguments
2021-04-13 19:59:02 -05:00
#--------------------------------------------------------------------------------------------------
2020-11-18 22:56:22 -06:00
_USERNAME="__token__"
_TOKEN=""
_TESTREPO=$_FALSE
PTYPE="test"
2021-04-13 19:59:02 -05:00
#--- FUNCTION -----------------------------------------------------------------------------------
2020-11-18 22:56:22 -06:00
# NAME: __usage
# DESCRIPTION: Display usage information.
2021-04-13 19:59:02 -05:00
#--------------------------------------------------------------------------------------------------
2020-11-18 22:56:22 -06:00
__usage() {
cat << EOT
Usage : ${__ScriptName} [options] <publish-type>
2021-04-13 19:59:02 -05:00
Options:
-h Display this help
2020-11-18 22:56:22 -06:00
Publish types:
- pypi Publish to pypi
- test Publish to test.pypi.org
EOT
} # ---------- end of function __usage ----------
while getopts ':h' opt
do
case "${opt}" in
h ) __usage; exit 0 ;;
\?) echo "Invalid option : $OPTARG"
__usage
exit 1
;;
esac
done
shift $((OPTIND-1))
# Define publish type
if [ "$#" -gt 0 ]; then
PTYPE=$1
shift
fi
# Check publish type
if [ "$(echo "$PTYPE" | grep -E '(pypi|test)')" = "" ]; then
echo "Publish type \"$PTYPE\" is invalid..."
exit 1
fi
# command: python3 -m twine upload --username $_USERNAME --password $_TOKEN --non-interactive --repository $_REPO dist/*
python3 -m twine upload --username $_USERNAME --password $_TOKEN --non-interactive --repository $_REPO dist/*