name: Release

on:
  release:
    types: [created]

jobs:
  Publish:
    runs-on: ubuntu-latest
    environment: release
    permissions:
      id-token: write
    steps:
    - uses: actions/checkout@v4
      with:
        fetch-depth: 0
    - name: Set up Python
      uses: actions/setup-python@v5
      with:
        python-version: 3.9
    - name: Install Nox
      run: |
        python -m pip install nox
    - name: Build a binary wheel and a source tarball
      run: |
        nox -e build
    - name: Publish package distributions to PyPI
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        print-hash: true
        verbose: true
        verify-metadata: true
