ci: add PyPI publishing on tag push#71
Merged
ericchansen merged 3 commits intomasterfrom Mar 19, 2026
Merged
Conversation
- Add .github/workflows/publish.yml triggered on v* tags - Switch to setuptools-scm for dynamic version from git tags - Enrich pyproject.toml with classifiers, keywords, readme for PyPI - Add build to dev dependencies - Uses OIDC trusted publishing (no API tokens needed) Workflow: git tag v5.0.0 && git push --tags → builds → publishes to PyPI. Requires one-time setup: add pending publisher at https://pypi.org/manage/account/publishing/ with: - Owner: ericchansen - Repository: q2mm - Workflow: publish.yml - Environment: pypi Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Auto-create GitHub Release on tag push with generated notes - Pre-release tags (a, b, rc, dev) marked as pre-release on GitHub - Stable tags create full releases with attached dist artifacts - Bumped permissions to contents: write for release creation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a GitHub Actions release pipeline to publish q2mm to PyPI on v* tag pushes, and updates packaging metadata to support tag-derived versions.
Changes:
- Introduces
.github/workflows/publish.ymlto build sdist/wheel on tag push and publish to PyPI via OIDC trusted publishing. - Switches
pyproject.tomlto dynamic versioning usingsetuptools-scmand expands PyPI metadata (readme/keywords/classifiers). - Adds
buildto thedevoptional dependency group.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
pyproject.toml |
Enables setuptools-scm dynamic versioning and improves PyPI metadata/extras. |
.github/workflows/publish.yml |
Adds tag-triggered build + version check + PyPI publish workflow using OIDC. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use importlib.metadata.version() so __version__ stays in sync with setuptools-scm derived version from git tags. Fallback to dev sentinel for editable installs or uninstalled imports. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Set up automated PyPI publishing so that pushing a git tag (
v5.0.0) automatically builds and publishes the package to PyPI.Changes
New:
.github/workflows/publish.ymlv*tag pushespython -m buildpypienvironment for deployment protectionUpdated:
pyproject.tomlversion = "5.0.0"tosetuptools-scmwhich derives the version from git tags automaticallyreadme,keywords,classifiersfor a proper PyPI listingbuildto dev extrasHow it works
Users can then install with:
One-time setup required
Before the first publish, register a pending publisher on PyPI:
q2mmericchansenq2mmpublish.ymlpypipypienvironment in GitHub repo settings (Settings > Environments > New)Verified locally
python -m buildproducesq2mm-4.1.dev55.tar.gzand.whlsuccessfullysetuptools-scmcorrectly derives version from git tags