Skip to content

Add tag-based release workflow and migrate to setuptools-scm#854

Open
andrewleech wants to merge 2 commits intopyserial:masterfrom
andrewleech:add-release-workflow
Open

Add tag-based release workflow and migrate to setuptools-scm#854
andrewleech wants to merge 2 commits intopyserial:masterfrom
andrewleech:add-release-workflow

Conversation

@andrewleech
Copy link
Copy Markdown

Summary

  • Tag-triggered GitHub Actions release workflow publishing to GitHub Releases and PyPI via trusted publishing (OIDC)
  • setuptools-scm migration replacing hardcoded __version__ with git-tag-derived versioning
  • tox docs environment now installs the package (skip_install = true removed) because setuptools-scm requires an actual install to resolve the version; the sys.path hack in conf.py is removed accordingly

Setup required

GitHub

  1. Create a pypi environment in repo Settings > Environments
  2. Optionally add environment protection rules (e.g. restrict to v* tags, require approval)

PyPI

  1. On pypi.org, go to the pyserial project > Publishing > Add a new publisher
  2. Configure the trusted publisher with:
    • Owner: pyserial
    • Repository: pyserial
    • Workflow: release.yaml
    • Environment: pypi

Read the Docs

  1. In the RTD dashboard, configure version activation to only activate tagged versions to avoid dev version strings (e.g. 3.6.dev81+gabcdef) in published docs

Usage

Tag a commit on master and push:

git tag v3.6.0
git push origin v3.6.0

The workflow runs the test suite, builds sdist + wheel with uv, then publishes to GitHub Releases and PyPI in parallel. Pre-release tags (e.g. v3.6.0rc1) are detected automatically.

pi-anl added 2 commits March 6, 2026 10:57
Triggered on version tags (v[0-9]+.[0-9]+.[0-9]+*). Runs the
test workflow first, builds sdist and wheel with uv, then publishes
to both GitHub Releases and PyPI in parallel.

Uses PyPI trusted publishing (OIDC) via a 'pypi' environment.
Pre-release tags are detected via simple pattern matching on the
tag name. Adds workflow_call trigger to the test workflow to
support reuse from the release workflow.
Version is now derived from git tags rather than a hardcoded string
in serial/__init__.py. setuptools-scm generates serial/_version.py
at build time. Fallback chain: _version.py -> importlib.metadata ->
"0.0.0+unknown".

Also: install the package in tox docs and RTD environments so
setuptools-scm can resolve the version during doc builds, remove
the now-redundant sys.path hack from documentation/conf.py, and
add a CHANGES.rst entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants