main
 1name: Create releases
 2on:
 3  schedule:
 4    - cron: '0 5 * * *' # every day at 5am UTC
 5  push:
 6    branches:
 7      - main
 8
 9jobs:
10  release:
11    name: release
12    if: github.ref == 'refs/heads/main' && github.repository == 'openai/openai-python'
13    runs-on: ubuntu-latest
14    environment: publish
15
16    steps:
17      - uses: actions/checkout@v4
18
19      - uses: stainless-api/trigger-release-please@v1
20        id: release
21        with:
22          repo: ${{ github.event.repository.full_name }}
23          stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
24
25      - name: Install Rye
26        if: ${{ steps.release.outputs.releases_created }}
27        run: |
28          curl -sSf https://rye.astral.sh/get | bash
29          echo "$HOME/.rye/shims" >> $GITHUB_PATH
30        env:
31          RYE_VERSION: '0.44.0'
32          RYE_INSTALL_OPTION: '--yes'
33
34      - name: Publish to PyPI
35        if: ${{ steps.release.outputs.releases_created }}
36        run: |
37          bash ./bin/publish-pypi
38        env:
39          PYPI_TOKEN: ${{ secrets.OPENAI_PYPI_TOKEN || secrets.PYPI_TOKEN }}