Add version ordering check and dry-run mode to publish workflow
The publish workflow had no guard against publishing a version that is equal to or older than the current PyPI release, and no safe way to test the workflow end-to-end without actually publishing.
Changes
publish.yml
-
Version ordering check — new step inserted between format validation and
pyproject.tomlupdate; queries the PyPI JSON API and usespackaging.version.Version(PEP 440-aware) to reject any input that is not strictly greater than the current release. Gracefully skips the check on first publish (HTTP 404). -
dry_runinput — optional boolean (defaultfalse). Whentrue, all validation and build steps run normally but the Publish to PyPI and Create release tag steps are skipped, making it safe to exercise the full workflow without side-effects.
CONTRIBUTING.md (new)
- Step-by-step instructions for triggering the workflow via the GitHub UI and the GitHub CLI
- Table showing which steps run in dry-run vs. real-release mode
- Version ordering rule examples for quick reference
Version ordering behaviour
Input (current latest: 1.0.0) |
Result |
|---|---|
1.0.1 / 2.0.0
|
|
1.0.0 |
|
0.9.9 |
|