Upload Python SDK Package #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload Python SDK Package | |
on: | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: "Publish Python SDK to PyPI" | |
required: false | |
default: "false" | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
jobs: | |
release-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Build release distributions | |
working-directory: sdk/python | |
run: | | |
python -m pip install --upgrade pip build | |
python -m build | |
- name: Upload distributions | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-dists | |
path: sdk/python/dist/ | |
pypi-publish: | |
runs-on: ubuntu-latest | |
needs: release-build | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Retrieve release distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-dists | |
path: dist/ | |
- name: Conditional Publish | |
if: ${{ inputs.publish == 'true' }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: dist/ | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |