Publish to PyPI #24
Workflow file for this run
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
# Release the Descartes Labs Python Client to PyPI | |
name: Publish to PyPI | |
on: | |
# Trigger manually (via Github Web UI) here: | |
# https://github.com/descarteslabs/descarteslabs-python/actions/workflows/pypi.yaml | |
# | |
# Documentation for manually running a workflow: | |
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: 'Publish packages to PyPI Repository' | |
required: true | |
default: true | |
type: boolean | |
repository: | |
description: 'PyPI Repository to upload package to' | |
required: true | |
default: 'pypi' | |
type: choice | |
options: | |
- 'testpypi' | |
- 'pypi' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the source code from this repository | |
- name: Checkout Source Code | |
uses: actions/checkout@v3 | |
# Setup the Python environment | |
- name: 'Setup Python Environment' | |
uses: actions/setup-python@v4 | |
# Build the Python wheel packages | |
- name: Build Python Packages | |
run: | | |
pip install twine | |
python3 setup.py bdist_wheel | |
python3 setup.py sdist | |
# Upload the Python wheel packages to PyPI using an API Token | |
# https://pypi.org/help/#apitoken | |
# https://github.com/descarteslabs/paas-infrastructure/blob/main/foundation/operations/pypi.tf | |
- name: Upload to PyPI | |
if: inputs.publish | |
env: | |
TWINE_REPOSITORY: "${{ inputs.repository }}" | |
TWINE_USERNAME: "__token__" | |
TWINE_PASSWORD: "${{ secrets.PYPI_API_TOKEN }}" | |
run: | | |
twine upload dist/* |