-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild_deploy.sh
executable file
·30 lines (25 loc) · 1.01 KB
/
build_deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
#================================================================
# DESCRIPTION
# This script builds the Python library and uploads the package either to testPyPi or PyPi, depending on the first argument provided.
# The argument can be '--local' for local testing, '--test' for uploading to testPyPi, or left empty for uploading to PyPi.
#================================================================
print_msg() {
local GRE='\e[1;32m'
local NC='\e[0m'
echo -e "${GRE}$1${NC}"
return 0
}
pip3 install -r requirements/release.txt
[ -d "dist" ] && rm -r dist && print_msg './dist dir deleted'
python3 -m build
[[ "$1" = "--local" ]] && print_msg 'tar.gz created in ./dist, install it locally via pip' && exit 0
if twine check dist/*; then
if [ "$1" = "--test" ] ; then
twine upload --repository testpypi dist/*
print_msg "Use this command for local testing:
python3 -m pip install --index-url https://test.pypi.org/simple/ --no-deps cron-converter"
else
twine upload dist/*
fi
fi