name: Release

on:
  release:
    types: [published]

# Use "trusted publishing", see https://docs.pypi.org/trusted-publishers/
jobs:
  release:
    name: Upload release to PyPI
    runs-on: ubuntu-latest
    environment:
      name: pypi
      url: https://pypi.org/p/nichecompass/
    permissions:
      id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
    steps:
      - uses: actions/checkout@v4
        with:
          filter: blob:none
          fetch-depth: 0
      - uses: actions/setup-python@v5
        with:
          python-version: "3.9"
          cache: "pip"
      - run: pip install build
      - run: python -m build
      - name: Publish package distributions to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1
