name: Publish to Test PyPI
on:
  release:
    types: [published]
jobs:
  pypi:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      - run: python3 -m pip install --upgrade setuptools && python3 -m pip install --upgrade setuptools_scm && python3 -m pip install --upgrade build && python3 -m build
      - name: Publish the latest package
        uses: pypa/gh-action-pypi-publish@release/v1
        with:
          repository_url: https://test.pypi.org/legacy/.
          password: ${{ secrets.PYPI_ACCESS_TOKEN }}
          packages_dir: dist
