-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds a pypi release action for the gradio python client #3743
Changes from all commits
71ce74a
d7dc767
ae5406e
eaaf2a4
88033af
c4b4660
27962bb
19e5ee9
4eb2a78
37bc6a5
e95cd7a
654c8ff
f380dca
d5e92f7
e366ba9
5a87766
431273e
d52e39d
f0c7889
242784d
f751cb2
abbcbef
777a025
0ccf2c6
991c6fe
ed68233
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need https://github.com/pypa/gh-action-pypi-publish#customizing-target-package-dists-directory There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I actually thought the same but that parameter must have gotten renamed. The correct parameter (at least for this version of the GH action) is |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.0.7 | ||
0.0.6b10 |
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 |
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 was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if we try this:
https://github.com/pypa/gh-action-pypi-publish#-master-branch-sunset-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that what we are already doing? We're providing the exact hash: 27b31702a0e7fc50959f5ad993c78deac1bdfc29