| 1 |
# This workflows will upload a Python Package using Twine when a release is created |
| 2 |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries |
| 3 |
|
| 4 |
name: Upload Python Package |
| 5 |
|
| 6 |
on: |
| 7 |
release: |
| 8 |
types: [published] |
| 9 |
workflow_dispatch: |
| 10 |
|
| 11 |
jobs: |
| 12 |
deploy: |
| 13 |
|
| 14 |
runs-on: ubuntu-latest |
| 15 |
|
| 16 |
steps: |
| 17 |
- uses: actions/checkout@v4 |
| 18 |
with: |
| 19 |
# Fetch all history so that setuptools_scm works correctly |
| 20 |
fetch-depth: 0 |
| 21 |
- name: Set up Python |
| 22 |
uses: actions/setup-python@v5 |
| 23 |
with: |
| 24 |
python-version: '3.x' |
| 25 |
- name: Install dependencies |
| 26 |
# Install build and packaging dependencies. |
| 27 |
# setuptools-scm is necessary for ensuring all files from VCS (such as |
| 28 |
# examples) are in the sdist. |
| 29 |
run: pip install -U pip build twine |
| 30 |
- name: Build and publish |
| 31 |
env: |
| 32 |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} |
| 33 |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |
| 34 |
run: | |
| 35 |
python -m build |
| 36 |
twine upload dist/* |