build: Fix dev version number generation #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
# Copyright DB Netz AG and contributors | |
# SPDX-License-Identifier: CC0-1.0 | |
name: Publish package | |
on: | |
workflow_dispatch: | |
push: | |
branches: [master] | |
tags: ["v*"] | |
pull_request: | |
jobs: | |
publish: | |
name: Publish artifacts | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
cache: pip | |
cache-dependency-path: pyproject.toml | |
python-version: "3.11" | |
- name: Install dependencies | |
run: python -m pip install -U pip build twine | |
- name: Build packages | |
run: python -m build | |
- name: Verify packages | |
run: python -m twine check dist/* | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Artifacts | |
path: 'dist/*' | |
- name: Publish to PyPI | |
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master' | |
run: python -m twine upload -u __token__ -p ${{ secrets.PYPI_TOKEN }} --non-interactive dist/* |