gradio/scripts/upload_to_pypi.sh

31 lines
903 B
Bash
Raw Normal View History

2020-07-07 06:18:33 +08:00
#!/bin/bash
if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
echo "Please run the script from repo directory"
exit -1
else
echo "Uploading to pypi"
set -e
git pull origin master
2022-02-22 07:30:26 +08:00
old_version=$(grep -Po "(?<=version=\")[^\"]+(?=\")" setup.py)
echo "Current version is $old_version. New version?"
read new_version
2022-02-22 07:30:26 +08:00
sed -i "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py
read -p "frontend updates? " -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
2021-12-24 16:18:09 +08:00
echo -n $new_version > gradio/version.txt
2022-02-24 14:59:44 +08:00
rm -rf gradio/templates/frontend
cd ui
2021-05-30 08:09:01 +08:00
npm run build
cd ..
2022-02-22 07:30:26 +08:00
aws s3 cp gradio/templates/frontend s3://gradio/$new_version/ --recursive # requires aws cli (contact maintainers for credentials)
fi
rm -r dist/*
rm -r build/*
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*
git add -A
git commit -m "updated PyPi version to $new_version"
2021-06-25 04:04:38 +08:00
fi