/ .github / workflows / publish-python-sdks.yml
publish-python-sdks.yml
  1  name: Publish Python SDKs
  2  
  3  permissions:
  4    contents: read
  5  
  6  on:
  7    push:
  8      tags:
  9        - "python/sandbox/v*"
 10        - "python/code-interpreter/v*"
 11        - "python/mcp/sandbox/v*"
 12  
 13  jobs:
 14    publish-sandbox:
 15      if: startsWith(github.ref, 'refs/tags/python/sandbox/v')
 16      runs-on: ubuntu-latest
 17      steps:
 18        - name: Checkout code
 19          uses: actions/checkout@v6
 20  
 21        - name: Set up Python
 22          uses: actions/setup-python@v6
 23          with:
 24            python-version: '3.10'
 25  
 26        - name: Install uv
 27          uses: astral-sh/setup-uv@v7
 28          with:
 29            version: "latest"
 30  
 31        - name: Generate API
 32          working-directory: sdks/sandbox/python
 33          run: |
 34            uv run python scripts/generate_api.py
 35  
 36        - name: Build package
 37          working-directory: sdks/sandbox/python
 38          run: |
 39            uv build
 40  
 41        - name: Publish to PyPI
 42          working-directory: sdks/sandbox/python
 43          env:
 44            UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
 45          run: |
 46            uv publish
 47  
 48    publish-code-interpreter:
 49      if: startsWith(github.ref, 'refs/tags/python/code-interpreter/v')
 50      runs-on: ubuntu-latest
 51      steps:
 52        - name: Checkout code
 53          uses: actions/checkout@v6
 54  
 55        - name: Set up Python
 56          uses: actions/setup-python@v6
 57          with:
 58            python-version: '3.10'
 59  
 60        - name: Install uv
 61          uses: astral-sh/setup-uv@v7
 62          with:
 63            version: "latest"
 64  
 65        - name: Build package
 66          working-directory: sdks/code-interpreter/python
 67          run: |
 68            uv build
 69  
 70        - name: Publish to PyPI
 71          working-directory: sdks/code-interpreter/python
 72          env:
 73            UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
 74          run: |
 75            uv publish
 76  
 77    publish-mcp-sandbox:
 78      if: startsWith(github.ref, 'refs/tags/python/mcp/sandbox/v')
 79      runs-on: ubuntu-latest
 80      steps:
 81        - name: Checkout code
 82          uses: actions/checkout@v6
 83  
 84        - name: Set up Python
 85          uses: actions/setup-python@v6
 86          with:
 87            python-version: "3.10"
 88  
 89        - name: Install uv
 90          uses: astral-sh/setup-uv@v7
 91          with:
 92            version: "latest"
 93  
 94        - name: Build package
 95          working-directory: sdks/mcp/sandbox/python
 96          run: |
 97            uv build
 98  
 99        - name: Publish to PyPI
100          working-directory: sdks/mcp/sandbox/python
101          env:
102            UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
103          run: |
104            uv publish