name: Publish Python 🐍 distributions 📦 to PyPI

on:
  push:
    tags:
      - "*"
  
jobs:
  pypi-publish:
    name: upload release to PyPI
    runs-on: ubuntu-latest
    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
    permissions:
      id-token: write
    steps:
      - name: Checkout
        uses: actions/checkout@v5
      - name: install build
        run: python -m pip install --upgrade build
      - name: build 
        run: python -m build
      - name: Publish package distributions to PyPI
        uses: pypa/gh-action-pypi-publish@release/v1