Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a GitHub Actions workflow for automated Python package publishing to both PyPI and TestPyPI. The workflow is based on the official Python Packaging Authority guide and implements trusted publishing using OIDC authentication.
Key changes:
- Automated build pipeline that creates distribution packages on all pull requests and pushes to master
- Production publishing to PyPI triggered only on tagged releases
- TestPyPI publishing for all builds to enable testing before production release
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
.github/workflows/python.yaml
Outdated
| publish-to-pypi: | ||
| name: >- | ||
| Publish Python 🐍 distribution 📦 to PyPI | ||
| if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes |
There was a problem hiding this comment.
The condition startsWith(github.ref, 'refs/tags/') will trigger on any tag push, but the workflow trigger specifies only tags matching release-*. This creates inconsistency where the job condition is broader than the trigger pattern. Consider either removing the tag pattern from the trigger (lines 8-9) to allow all tags, or updating the condition to startsWith(github.ref, 'refs/tags/release-') to match the trigger pattern.
| if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes | |
| if: startsWith(github.ref, 'refs/tags/release-') # only publish to PyPI on release-* tag pushes |
The file taken from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ Set local_scheme = "dirty-tag" for setuptools_scm so that generated packages could be uploaded to test.pypi.org
The file taken from https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/