gradio/scripts/gh_action_pypi.sh
2022-06-10 00:39:46 -07:00

25 lines
732 B
Bash
Executable File

#!/bin/bash
if [ -z "$(ls | grep CONTRIBUTING.md)" ]; then
echo "Please run the script from repo directory"
exit -1
else
old_version=$(grep -Po "(?<=version=\")[^\"]+(?=\")" setup.py)
read -r new_version < gradio/version.txt
sed -i "s/version=\"$old_version\"/version=\"$new_version\"/g" setup.py
rm -rf gradio/templates/frontend
rm -rf gradio/templates/cdn
cd ui
pnpm i
pnpm build
GRADIO_VERSION=$new_version pnpm build:cdn
cd ..
aws s3 cp gradio/templates/cdn s3://gradio/$new_version/ --recursive # requires aws cli (contact maintainers for credentials)
cp gradio/templates/cdn/index.html gradio/templates/frontend/share.html
rm -r dist/*
rm -r build/*
python3 setup.py sdist bdist_wheel
fi