2020-07-07 06:18:33 +08:00
|
|
|
#!/bin/bash
|
2022-01-28 22:14:14 +08:00
|
|
|
if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
|
|
|
|
echo "Please run the script from repo directory"
|
|
|
|
exit -1
|
|
|
|
else
|
|
|
|
echo "Uploading to pypi"
|
|
|
|
set -e
|
2022-02-28 01:02:36 +08:00
|
|
|
git pull
|
2022-02-22 07:30:26 +08:00
|
|
|
old_version=$(grep -Po "(?<=version=\")[^\"]+(?=\")" setup.py)
|
2022-01-28 22:14:14 +08:00
|
|
|
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
|
2022-01-28 22:14:14 +08:00
|
|
|
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
|
2022-02-11 03:22:22 +08:00
|
|
|
cd ui
|
2022-02-28 01:02:36 +08:00
|
|
|
pnpm i
|
|
|
|
pnpm build
|
2021-05-30 08:09:01 +08:00
|
|
|
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)
|
2022-01-28 22:14:14 +08:00
|
|
|
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
|
|
|
|
|