add a release workflow - #54
Merged
Merged
Conversation
Pushing a release tag now builds the sdist, checks that it is complete and installable, drafts the GitHub release with it and uploads it to PyPI via trusted publishing.
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.
Releasing borghash was fully manual so far:
python -m buildandtwine uploadon the maintainer machine, with a PyPI API token. This adds.github/workflows/release.yml, triggered by pushing a release tag, so that a release is just "update CHANGES, merge, tag, push".The workflow has two jobs:
twine checks it, checks that the sdist really is the one for the pushed tag (a missing or unfetched tag would silently give a setuptools-scm dev version), installs it into a clean venv and runs the test suite plusborghash-demoagainst that installation, then drafts the GitHub release with the sdist attached. It is a draft because the release notes want a human; a re-run replaces the assets instead of failing.pypienvironment gate applies to the irreversible step alone.No wheels: borghash is a Cython extension, and only the sdist has ever been published. The sdist install check is the release gate here -
ci.ymldoes not run on a tag push, and nothing else ever installs borghash from a sdist.The sdist must be cythonized before
python -m buildruns: the.cfiles are not in git and Cython is not inbuild-system.requires, so the isolated build environment cannot cythonize.ci.ymlalready does it in that order.Actions are pinned to commit SHAs.
README.rstgets a "Making a release" section describing the procedure.One-time setup needed before the first release
borghashproject: ownerborgbackup, repositoryborghash, workflowrelease.yml, environmentpypi.pypienvironment in the repository settings. Nothing in it is required, but configuring required reviewers makes the upload wait for an approval - the last chance to stop a release. "Prevent self-review" has to stay off for that to be approvable by the person who tagged.Testing
Verified locally against a clean clone at tag
0.2.0, with the exact package set and Python version the workflow uses: build,twine check, install into a fresh venv without Cython, 66 tests pass,borghash-demoruns. The version guard was checked both ways (a dev-version sdist fails it). The release-drafting shell logic was exercised withghstubbed: the create path, the--prereleasepath for ab1tag, and theupload --clobberre-run path.Not provable without a real tag: the artifact hand-off between the two jobs and the PyPI upload itself.