Publish Python Package to PyPI #16
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: Publish Python Package to PyPI | |
on: | |
workflow_dispatch: | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: python | |
steps: | |
- uses: actions/checkout@9a9194f87191a7e9055e3e9b95b8cfb13023bb08 | |
- name: Copy files | |
run: | | |
cp ../LICENSE . | |
- name: Set up Python | |
uses: actions/setup-python@2bd53f9a4d1dd1cd21eaffcc01a7b91a8e73ea4c | |
with: | |
python-version: '3.12' | |
- name: Install build dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade build twine | |
- name: Build package | |
run: python -m build | |
- name: Check distribution | |
run: twine check dist/* | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{secrets.PYPI_API_TOKEN}} | |
run: python -m twine upload dist/* --verbose |