Publish Python library #3
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 library | |
on: | |
workflow_dispatch: | |
env: | |
GITHUB_REF: "${{ github.ref }}" | |
jobs: | |
build_and_publish: | |
name: Build distribution of library | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
cache: 'pip' # caching pip dependencies | |
- name: Prepare build | |
run: python3 -m pip install --upgrade build | |
- name: Install Twine | |
run: python3 -m pip install --upgrade twine | |
- name: Build package | |
run: python3 -m build | |
- name: Check distribution | |
run: python3 -m twine check --strict dist/* | |
- name: Publish package | |
run: python3 -m twine upload dist/* | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} |