Skip to content

Add a release workflow that publishes to GitHub and PyPI - #297

Merged
mattjala merged 3 commits into
HDFGroup:masterfrom
mattjala:ci/release-workflow
Sep 2, 2026
Merged

mattjala merged 3 commits into
HDFGroup:masterfrom
mattjala:ci/release-workflow

Conversation

@mattjala

@mattjala mattjala commented Sep 2, 2026 •

Copy link
Copy Markdown
Collaborator

No description provided.

@mattjala
mattjala force-pushed the ci/release-workflow branch from 3191dc2 to 461ab05 Compare September 2, 2026 14:26
h5pyd has been released and published to PyPI by hand - there is no
release automation in the repo at all. Add a tag-driven workflow that
builds the sdist and wheel once, checks the metadata, attaches them to a
GitHub release, and then uploads them to PyPI via Trusted Publishing.

PyPI is gated on the GitHub release rather than running alongside it.
The two are not equally recoverable: a GitHub release can be deleted and
recreated, while PyPI permanently burns a version number, so the
irreversible half only runs once the recoverable half has succeeded.

The version job resolves the version from pyproject.toml and fails if
h5pyd/version.py disagrees, since version.py is what h5pyd.__version__
reports at runtime while pyproject.toml names the wheel. The build job
re-checks this against the installed wheel so the two cannot drift onto
PyPI.

conda-forge is not driven from here; h5pyd-feedstock picks up new
versions from PyPI on its own.
pyproject.toml declares 1.0.0 while version.py still said 0.24.0, and
__init__.py re-exports version.py as h5pyd.__version__. A wheel built
from master is therefore named h5pyd-1.0.0 but reports 0.24.0 once
installed, so 'pip install h5pyd==1.0.0' yields a package that disagrees
with itself.

Bump version.py to match. This is also a prerequisite for the release
workflow, whose version job fails while the two disagree.
Releasing required tagging by hand first, because the tag was the
trigger. Derive it from pyproject.toml and create it in the workflow
instead, so a release is one dispatch and the tag cannot disagree with
the version it claims to be.

The tag job sits after build and before github-release, keeping the
pipeline ordered by how hard each step is to undo: validate and build
create nothing, a tag and a release can be deleted, a PyPI upload
cannot. A failed build therefore never leaves a stray tag behind.

Re-running after a later job fails is expected, so an existing tag is a
no-op when it already points at the commit being released and a hard
error when it points somewhere else, rather than silently re-tagging.

The push trigger is dropped: with the tag created here, pushing one by
hand would no longer start a release, and leaving the trigger in place
would offer a second path that behaves differently from the first. Note
a tag pushed by the workflow could not have triggered it anyway - events
raised with GITHUB_TOKEN do not start new workflow runs.
@mattjala
mattjala force-pushed the ci/release-workflow branch from e7f5836 to 09a7ff5 Compare September 2, 2026 17:22
@mattjala
mattjala merged commit e6b100b into HDFGroup:master Sep 2, 2026
6 checks passed
@mattjala
mattjala deleted the ci/release-workflow branch September 2, 2026 18:18
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.

1 participant