CI #5
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| tags: | |
| - "v*" # Push on version tags like v1.0, v1.0.0, etc. | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| build-and-publish: | |
| name: Build and publish Python distributions to PyPI | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # Required for trusted publishing | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.9" | |
| - name: Install Poetry | |
| uses: snok/[email protected] | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Install dependencies | |
| run: poetry install --no-interaction --no-root | |
| - name: Format package | |
| run: poetry run black . | |
| - name: Lint package | |
| run: poetry run flake8 | |
| - name: Test package | |
| run: poetry run pytest | |
| - name: Check types | |
| run: poetry run mypy poodle | |
| - name: Build package | |
| run: poetry build | |
| - name: Publish package to PyPI | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} |