|
| 1 | +# Releasing wagtail-honeypot |
| 2 | + |
| 3 | +This is the maintainer runbook for publishing package releases to PyPI via GitHub Actions. |
| 4 | + |
| 5 | +## Release Workflow |
| 6 | + |
| 7 | +- Workflow file: `.github/workflows/release.yml` |
| 8 | +- Trigger: GitHub Release event `published` |
| 9 | +- Authentication: PyPI Trusted Publisher (OIDC), no API token secret |
| 10 | + |
| 11 | +The release workflow: |
| 12 | + |
| 13 | +1. validates GitHub release tag (`vX.Y.Z` or pre-release like `vX.Y.Zrc1`) matches `project.version` in `pyproject.toml` |
| 14 | +2. validates the tagged commit is contained in `origin/main` |
| 15 | +3. builds `sdist` + `wheel` with `uv build` |
| 16 | +4. runs `twine check` on built artifacts |
| 17 | +5. publishes artifacts to PyPI using `pypa/gh-action-pypi-publish` |
| 18 | + |
| 19 | +## One-Time Setup (PyPI Trusted Publisher) |
| 20 | + |
| 21 | +In the PyPI project settings for `wagtail-honeypot`, add a Trusted Publisher with: |
| 22 | + |
| 23 | +- Owner or organization: `nm-packages` |
| 24 | +- Repository: `wagtail-honeypot` |
| 25 | +- Workflow: `release.yml` |
| 26 | +- Environment: unset (unless intentionally adding GitHub Environments later) |
| 27 | + |
| 28 | +The GitHub repository and workflow identity must match exactly, or publish will fail. |
| 29 | + |
| 30 | +## Maintainer Release Steps |
| 31 | + |
| 32 | +1. Keep `CHANGELOG` updated under `## Unreleased` for every merged PR landing on `main`. |
| 33 | +2. Update `version` in `pyproject.toml` to the intended release version. |
| 34 | +3. Convert the current `## Unreleased` notes in `CHANGELOG` into the new release entry, then leave a fresh `## Unreleased` placeholder for future work. |
| 35 | +4. Review user-facing docs and examples that intentionally describe the current release, and either: |
| 36 | + - update them to the new version where exact release numbers are still useful, or |
| 37 | + - remove brittle hardcoded release numbers when the docs work just as well without them. |
| 38 | +5. Merge the release-prep changes to `main`. |
| 39 | +6. Ensure normal CI on `main` is green (`Tests` workflow). |
| 40 | +7. Create a GitHub Release with a tag that matches the package version with `v` prefix. |
| 41 | +8. Use the `CHANGELOG` entry as the GitHub Release body. |
| 42 | +9. Publish the GitHub Release. |
| 43 | +10. Confirm `.github/workflows/release.yml` succeeds and the version appears on PyPI. |
| 44 | + |
| 45 | +For local sandbox/test command workflows before a release, use: |
| 46 | + |
| 47 | +- [developer.md](../developer.md) for canonical developer workflow and quickstart commands |
| 48 | +- [AGENTS.md](https://github.com/nm-packages/wagtail-honeypot/blob/release/AGENTS.md) for canonical contributor command/reference guidance |
| 49 | + |
| 50 | +## Changelog Maintenance |
| 51 | + |
| 52 | +- Add or update a `CHANGELOG` entry under `## Unreleased` in every PR. |
| 53 | +- During release prep, move or rewrite the `Unreleased` notes into the new versioned release section. |
| 54 | +- After release prep, keep an empty `## Unreleased` section in place for subsequent work. |
| 55 | +- During release prep, review any docs/examples that intentionally point at the current package release and avoid leaving stale version numbers in user-facing pages. |
| 56 | + |
| 57 | +Examples: |
| 58 | + |
| 59 | +- `pyproject.toml` version `1.3.0` => GitHub tag `v1.3.0`, release title `1.3.0` (or `Release 1.3.0`) |
| 60 | +- `pyproject.toml` version `1.4.0rc1` => GitHub tag `v1.4.0rc1`, release title `1.4.0rc1` (or `Release 1.4.0rc1`) |
| 61 | + |
| 62 | +## Local Preflight (Optional but Recommended) |
| 63 | + |
| 64 | +Run these before creating the GitHub Release: |
| 65 | + |
| 66 | +```bash |
| 67 | +uv build --sdist --wheel --out-dir /tmp/wagtail-honeypot-dist-check |
| 68 | +uvx twine check /tmp/wagtail-honeypot-dist-check/* |
| 69 | +``` |
| 70 | + |
| 71 | +## Failure Modes and Troubleshooting |
| 72 | + |
| 73 | +- Tag/version mismatch: |
| 74 | + - Symptom: workflow fails in "Validate release tag matches package version" |
| 75 | + - Fix: align GitHub tag with `pyproject.toml` version and republish release |
| 76 | +- Tag commit not on main: |
| 77 | + - Symptom: workflow fails in "Validate release commit is on main" |
| 78 | + - Fix: retag a commit that is on `main` |
| 79 | +- Trusted Publisher identity mismatch: |
| 80 | + - Symptom: PyPI publish step reports authorization/trust failure |
| 81 | + - Fix: verify owner/repo/workflow values in PyPI Trusted Publisher settings |
| 82 | +- Duplicate version: |
| 83 | + - Symptom: publish step fails because version already exists on PyPI |
| 84 | + - Fix: bump `pyproject.toml` version and publish a new tag/release |
0 commit comments