name: Upload to PyPI

on:
  release:
    types: [published]

jobs:
  deploy:
    runs-on: ubuntu-latest
    environment: publishing
    permissions:
      # IMPORTANT: this permission is mandatory for trusted publishing
      id-token: write
    steps:
      # clone repo and set up python
      - uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v4
        with:
          python-version: "3.10"
      # install build package and build dist
      - name: Build distribution
        run: >-
          python3 -m pip install poetry &&
          poetry build
      # retrieve your distributions here
      - name: Publish package distributions to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
