name: Release to PyPI

on:
  release:
    types: [published]

jobs:
  build_and_publish:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v3
    - run: pipx run poetry build
    - run: pipx run poetry publish
      env:
        POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
