Debian Codegraph @

RELEASING.md

raw
1 # Releasing
2
3 The version is derived automatically from the latest Git tag (via
4 poetry-dynamic-versioning and CMake), so there is no version string to bump in
5 the source tree. A release is driven by the changelog: the topmost `## [X.Y.Z]`
6 heading in `CHANGELOG.md` names the version, and merging a PR labelled `release`
7 tells CI to tag that commit and stage the release.
8
9 The changelog (`CHANGELOG.md`) is maintained by hand following
10 [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). Add notable,
11 user-facing changes under the `## [Unreleased]` heading as part of the PR that
12 makes them.
13
14 To cut release `X.Y.Z`:
15
16 1. Open a release PR that edits `CHANGELOG.md`:
17 - Rename `## [Unreleased]` to `## [X.Y.Z] - YYYY-MM-DD`.
18 - Add a fresh, empty `## [Unreleased]` heading above it.
19 - Update the link references at the bottom: point `[unreleased]` at
20 `compare/X.Y.Z...HEAD` and add `[X.Y.Z]: .../compare/<prev>...X.Y.Z`.
21 2. Add the **`release`** label to the PR.
22 3. Merge it. CI builds and stages a **draft** GitHub Release.
23 4. Review the draft Release, then **publish it by hand**. Publishing uploads the
24 package to PyPI.
25
26 The tag is not created by hand: the `Release` workflow reads `X.Y.Z` from the
27 changelog and tags the merge commit itself.
28
29 ## What CI does
30
31 Merging a `release`-labelled PR runs the `Release` workflow
32 (`.github/workflows/release.yaml`):
33
34 1. **prepare** — reads the version from the top of `CHANGELOG.md`
35 (`devtools/changelog.sh version`), fails if that tag already exists, and tags
36 the merge commit. The release notes are the changelog section for that
37 version (`devtools/changelog.sh notes`).
38 2. **build** — reuses the `Build distributions` workflow
39 (`.github/workflows/build-dist.yaml`) against the new tag to build the pyMBD
40 source distribution and the libMBD source archive.
41 3. **draft** — creates the GitHub Release as a draft with both source archives
42 attached.
43
44 Publishing the draft by hand fires `release: published`, which runs the
45 `Publish` workflow (`.github/workflows/publish.yaml`): it downloads the pyMBD
46 sdist from the Release and uploads it to [PyPI](https://pypi.org/project/pymbd/)
47 via [trusted publishing](https://docs.pypi.org/trusted-publishers/) (no API token
48 is stored). PyPI therefore receives the exact artifact attached to the Release.
49
50 Every asset is attached to the draft before it is published, so publishing is
51 compatible with
52 [immutable releases](https://docs.github.com/en/code-security/concepts/supply-chain-security/immutable-releases):
53 an immutable release is frozen the moment it is published. Uploading to PyPI
54 reads the Release without modifying it.
55
56 Only the source distribution goes to PyPI: pyMBD's C extension is compiled
57 against an external libMBD at install time, so a binary wheel would bake in one
58 libMBD build and break for everyone else. The libMBD source archive
59 (`libmbd-X.Y.Z.tar.gz`, built by `devtools/source-dist.sh`) is published only as
60 a Release asset, alongside GitHub's auto-generated source code archives.
61
62 Conda-forge's autotick bot then picks up the new release and opens a
63 version-bump PR on the
64 [`libmbd-feedstock`](https://github.com/conda-forge/libmbd-feedstock), which
65 builds and publishes the `libmbd` conda package once merged.
66
67 ## Configuration
68
69 - **PyPI trusted publisher.** The `pymbd` project trusts the `publish.yaml`
70 workflow under the `pypi` environment.
71 - **Immutable releases.** Optionally enable immutable releases (repository →
72 Settings → General, or at the organization level); the draft-then-publish flow
73 already produces releases that satisfy it.