gradio/build_pypi.sh
D V 52f7831751
refactor: Use package.json for version management (#5514)
* refactor: Use package.json for version management

- uses package.json file for version management.
- updated the regex pattern.
- removed the logic that creates or updates the version.txt file

* load version through package.json

* fix code duplication

* add changeset

* add changeset

* fixes

* fix

* package version

* fix

* typing

* typing

* changes

* add changeset

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
2023-09-15 16:23:52 -07:00

22 lines
691 B
Bash
Executable File

#!/bin/bash
set -e
cd "$(dirname ${0})"
# You should update the version in package.json before running this script
FILE="gradio/package.json"
new_version=$(python -c "import json; f = open('$FILE', 'r'); data = json.load(f); print(data['version']); f.close();")
GRADIO_VERSION = $new_version
rm -rf gradio/templates/frontend
rm -rf gradio/templates/cdn
pnpm i --frozen-lockfile --ignore-scripts
GRADIO_VERSION=$new_version pnpm build
GRADIO_VERSION=$new_version pnpm build:cdn
aws s3 cp gradio/templates/cdn "s3://gradio/${new_version}/" --recursive --region us-west-2
cp gradio/templates/cdn/index.html gradio/templates/frontend/share.html
rm -rf dist/*
rm -rf build/*
python3 -m build