-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a pypi release action for the gradio python client (#3743)
* release action * fixes * name * Update version.txt * Update version.txt * update * fixes * version * rename * action * fix token * custom dir * fixes * change password * revert back to token * scripts * remove twine
- Loading branch information
1 parent
8e93f8a
commit b41335a
Showing
6 changed files
with
69 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# This workflow will upload a Python Package when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
|
||
name: Upload Gradio Client Python Package | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: closed | ||
branches: | ||
- main | ||
paths: | ||
- 'client/python/gradio_client/version.txt' | ||
|
||
jobs: | ||
deploy: | ||
if: github.event.pull_request.merged == true || github.event.action == '' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
- name: Check new pypi version | ||
run: python client/python/scripts/check_pypi.py | ||
- name: Build pypi package | ||
run: | | ||
client/python/scripts/build_pypi.sh | ||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: aabid93 | ||
password: ${{ secrets.PYPI_GRADIO_CLIENT_TOKEN }} | ||
packages_dir: client/python/dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.0.7 | ||
0.0.6b10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
cd "$(dirname ${0})/.." | ||
|
||
python3 -m pip install build | ||
rm -rf dist/* | ||
rm -rf build/* | ||
python3 -m build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import json | ||
import sys | ||
import urllib.request | ||
from pathlib import Path | ||
|
||
version_file = Path(__file__).parent.parent / "gradio_client" / "version.txt" | ||
version = version_file.read_text(encoding="utf8").strip() | ||
|
||
with urllib.request.urlopen("https://pypi.org/pypi/gradio_client/json") as url: | ||
releases = json.load(url)["releases"] | ||
|
||
if version in releases: | ||
print(f"Version {version} already exists on PyPI") | ||
sys.exit(1) | ||
else: | ||
print(f"Version {version} does not exist on PyPI") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.