name: continuous-integration

on: [push, pull_request]

jobs:

  publish:

    name: Publish to PyPi
    if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
    runs-on: ubuntu-latest
    steps:
      - name: Checkout source
        uses: actions/checkout@v6
      - name: Set up Python 3.11
        uses: actions/setup-python@v6
        with:
          python-version: "3.11"
      - name: Build package
        run: |
          pip install wheel
          python setup.py bdist_wheel sdist
      - name: Publish
        uses: pypa/gh-action-pypi-publish@v1.13.0
        with:
          user: __token__
          password: ${{ secrets.PYPI_KEY }}
          packages_dir: dist/