2022-06-10 15:29:29 +08:00
# This workflow will upload a Python Package using Twine 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 Python Package
on :
2022-09-07 04:49:49 +08:00
workflow_dispatch :
2022-06-10 15:29:29 +08:00
pull_request :
types : closed
branches :
- main
paths :
- 'gradio/version.txt'
2022-12-10 14:05:15 +08:00
env :
NODE_OPTIONS : "--max-old-space-size=4096"
2022-06-10 15:29:29 +08:00
jobs :
deploy :
2022-09-07 04:49:49 +08:00
if : github.event.pull_request.merged == true || github.event.action == ''
2022-06-10 15:29:29 +08:00
runs-on : ubuntu-latest
steps :
- uses : actions/checkout@v3
2022-06-10 15:50:41 +08:00
- name : Install Python
2023-06-22 02:15:52 +08:00
uses : actions/setup-python@v4
2022-06-10 15:29:29 +08:00
with :
python-version : '3.x'
2022-09-07 04:49:49 +08:00
- name : Check new pypi version
2022-09-15 05:39:46 +08:00
run : python scripts/check_pypi.py
2022-06-10 15:50:41 +08:00
- name : Install pnpm
2023-06-02 16:00:00 +08:00
uses : pnpm/action-setup@v2
2022-06-10 15:54:36 +08:00
with :
2023-06-02 16:13:58 +08:00
version : 8
2022-09-15 05:39:46 +08:00
- name : Install build tool dependencies
run : python -m pip install build
2022-06-10 15:50:41 +08:00
- name : Build pypi package
2022-09-15 05:39:46 +08:00
run : |
2022-06-14 04:34:42 +08:00
export AWS_ACCESS_KEY_ID=${{ secrets.AWSACCESSKEYID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWSSECRETKEY }}
2022-06-14 04:39:18 +08:00
export AWS_DEFAULT_REGION=us-west-2
2022-06-14 04:34:42 +08:00
scripts/gh_action_pypi.sh
2022-06-10 15:29:29 +08:00
- name : Publish package
uses : pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with :
user : __token__
password : ${{ secrets.PYPI_API_TOKEN }}
2022-07-13 21:58:11 +08:00
gh-release :
needs : deploy
runs-on : ubuntu-latest
2022-10-04 03:36:59 +08:00
outputs :
version : ${{ steps.set_output.outputs.version }}
2022-07-13 21:58:11 +08:00
steps :
- uses : actions/checkout@v3
- name : Set release name
run : echo "INPUT_NAME=v$(cat gradio/version.txt)" >> $GITHUB_ENV
- name : Release
uses : softprops/action-gh-release@v1
with :
name : ${{ env.INPUT_NAME }}
2022-10-04 03:36:59 +08:00
tag_name : ${{ env.INPUT_NAME }}
- id : set_output
run : echo "::set-output name=version::${{ env.INPUT_NAME }}"
modify-release-notes :
needs : gh-release
runs-on : ubuntu-latest
if : ${{ !contains( needs.gh-release.outputs.version, 'b') }}
steps :
- uses : actions/checkout@v3
- name : Install Python
2023-06-22 02:15:52 +08:00
uses : actions/setup-python@v4
2022-10-04 03:36:59 +08:00
with :
python-version : '3.x'
- name : Set release name
run : echo "INPUT_NAME=v$(cat gradio/version.txt)" >> $GITHUB_ENV
- name : Format Release Notes for Next Release
run : python scripts/format_release_notes.py ${{ env.INPUT_NAME }}
- name : Commit files
uses : EndBug/add-and-commit@v9
with :
add : CHANGELOG.md
author_name : "GH ACTIONS"
author_email : ""