# workflow for re-running publishing to PyPI in case it fails for some reason
# you can run this workflow by navigating to https://www.github.com/openai/openai-python/actions/workflows/publish-pypi.yml
name: Publish PyPI
on:
  workflow_dispatch:

jobs:
  publish:
    name: publish
    runs-on: ubuntu-latest
    environment: publish

    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6

      - name: Set up Rye
        uses: eifinger/setup-rye@c694239a43768373e87d0103d7f547027a23f3c8
        with:
          version: '0.44.0'
          enable-cache: true

      - name: Publish to PyPI
        run: |
          bash ./bin/publish-pypi
        env:
          PYPI_TOKEN: ${{ secrets.OPENAI_PYPI_TOKEN || secrets.PYPI_TOKEN }}
