gradio/.github/workflows/deploy-pypi.yml
renovate[bot] 4a0e387e7b
chore(deps): update pypa/gh-action-pypi-publish digest to 3be882c (#4600)
* chore(deps): update pypa/gh-action-pypi-publish digest to 3be882c

* fix action version

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: pngwn <hello@pngwn.io>
2023-06-23 14:56:08 +01:00

87 lines
2.7 KiB
YAML

# 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:
workflow_dispatch:
pull_request:
types: closed
branches:
- main
paths:
- 'gradio/version.txt'
env:
NODE_OPTIONS: "--max-old-space-size=4096"
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@v4
with:
python-version: '3.x'
- name: Check new pypi version
run: python scripts/check_pypi.py
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Install build tool dependencies
run: python -m pip install build
- name: Build pypi package
run: |
export AWS_ACCESS_KEY_ID=${{ secrets.AWSACCESSKEYID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.AWSSECRETKEY }}
export AWS_DEFAULT_REGION=us-west-2
scripts/gh_action_pypi.sh
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
gh-release:
needs: deploy
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_output.outputs.version }}
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 }}
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
uses: actions/setup-python@v4
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: ""