Don't publish to TestPyPI on pushes to main It turns out that it was complicated to set up because nobody does it, and in fact it still doesn't work due to the tagging scheme used by setuptools-scm. That could be worked around, but since that's not the intended usage of TestPyPI, don't. https://github.com/pypa/packaging-problems/issues/844 explains that the setup guide is misleading since TestPyPI is not intended to be used for pushes from a CI pipeline. Hence, only push to TestPyPI on tag creation. This makes me question the value of TestPyPI in the context of CI/CD, but whatever.
diff --git a/.github/workflows/build-and-publish-package.yml b/.github/workflows/build-and-publish-package.yml index 0728661..c4832b3 100644 --- a/.github/workflows/build-and-publish-package.yml +++ b/.github/workflows/build-and-publish-package.yml
@@ -32,7 +32,7 @@ publish-to-testpypi: runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/main' # only publish to test.PyPI on pushes to main + if: startsWith(github.ref, 'refs/tags/') # only publish to TestPyPI on tag pushes name: Publish LNT to TestPyPI needs: [build]