name: Publish to PyPI

on:
  push:
    tags:
      # Setuptools_scm currently always wants a patch version in the tag.
      # See https://github.com/pypa/setuptools_scm#semantic-versioning-semver
      - '[0-9]+.[0-9]+.[0-9]+'
      - '[0-9]+.[0-9]+.[0-9]+.post[0-9]+'

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
      with:
        # Need full history for setuptools_scm to work
        fetch-depth: 0
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install build
    - name: Build package
      run: python -m build

    - name: Publish to Test PyPI
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        repository_url: https://test.pypi.org/legacy/
        password: ${{ secrets.TEST_PYPI_API_TOKEN }}

    - name: Publish to PyPI
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        password: ${{ secrets.PYPI_API_TOKEN }}

Add workflow to publish to PyPI
Add workflow to publish to PyPI
