|
| 1 | +# 09 — Releasing mcpp |
| 2 | + |
| 3 | +How a release of **mcpp itself** reaches users. This is maintainer-facing; for |
| 4 | +packaging *your own* project see [02 — Packaging for Release](02-pack-and-release.md). |
| 5 | + |
| 6 | +Until now this process lived only in commit messages and workflow comments. One |
| 7 | +of those commit messages contains a misdiagnosis that is corrected in §5. |
| 8 | + |
| 9 | +## 1. The four version sites are two groups |
| 10 | + |
| 11 | +| Site | Group | Moves when | |
| 12 | +|---|---|---| |
| 13 | +| `mcpp.toml` `[package].version` | **being built** | you start work on a new version | |
| 14 | +| `src/toolchain/fingerprint.cppm` `MCPP_VERSION` | **being built** | same commit as above (compiled-in copy) | |
| 15 | +| `.xlings.json` `[workspace].mcpp` | **bootstrapped from** | separately, *after* a release is installable | |
| 16 | +| `ci-fresh-install.yml` `MCPP_PIN` | ~~bootstrapped from~~ | **nothing — it is derived at run time** (§4) | |
| 17 | + |
| 18 | +`.github/tools/check_version_pins.sh` enforces what is left mechanically. The two |
| 19 | +"being built" sites must be equal; the bootstrap pin must never be **newer** than |
| 20 | +the version being built. |
| 21 | + |
| 22 | +The two groups are deliberately allowed to differ. Bumping them together is what |
| 23 | +an earlier revision of the pin checker required, and it sent every CI job to |
| 24 | +install a version that did not exist yet. |
| 25 | + |
| 26 | +## 2. The pipeline |
| 27 | + |
| 28 | +`release.yml` (tag push, or `workflow_dispatch` with no input, which derives the |
| 29 | +tag from `mcpp.toml`) does all of this: |
| 30 | + |
| 31 | +``` |
| 32 | +build ×4 (linux x86_64 / linux aarch64 / macOS ARM64 / Windows x64) |
| 33 | + → GitHub Release v<version> with tarballs + .sha256 sidecars |
| 34 | + → mirror to xlings-res/mcpp on BOTH GitHub and GitCode |
| 35 | + → open the version-bump PR against openxlings/xim-pkgindex |
| 36 | + → workflow_run hook fires ci-fresh-install |
| 37 | +``` |
| 38 | + |
| 39 | +Two steps are **not** automated: |
| 40 | + |
| 41 | +- **merging the xim-pkgindex bump PR** — a maintainer does it. Until it lands, |
| 42 | + the released version is downloadable but not installable via `xlings install`. |
| 43 | +- **bumping `.xlings.json`** — see §4. |
| 44 | + |
| 45 | +## 3. Verifying a release |
| 46 | + |
| 47 | +The mirror script verifies its own uploads, but the checks worth doing by hand |
| 48 | +are the ones that do not trust a sidecar: |
| 49 | + |
| 50 | +```bash |
| 51 | +V=<version> |
| 52 | +# both hosts serve every platform, byte-exact |
| 53 | +for a in linux-x86_64.tar.gz linux-aarch64.tar.gz macosx-arm64.tar.gz windows-x86_64.zip; do |
| 54 | + for h in github.com gitcode.com; do |
| 55 | + curl -fsSL -o /dev/null -w "$h $a %{http_code} %{size_download}\n" \ |
| 56 | + "https://$h/xlings-res/mcpp/releases/download/$V/mcpp-$V-$a" |
| 57 | + done |
| 58 | +done |
| 59 | +# the index's sha256 values match the payloads (recompute; do not read the sidecar) |
| 60 | +curl -fsSL -o /tmp/p.tgz "https://github.com/xlings-res/mcpp/releases/download/$V/mcpp-$V-linux-x86_64.tar.gz" |
| 61 | +sha256sum /tmp/p.tgz # compare against pkgs/m/mcpp.lua in xim-pkgindex |
| 62 | +``` |
| 63 | + |
| 64 | +Then a real install, in a **clean-room `XLINGS_HOME`** — never the machine's own |
| 65 | +`~/.xlings`, which can mask a broken index with cached state: |
| 66 | + |
| 67 | +```bash |
| 68 | +export XLINGS_HOME=$(mktemp -d) |
| 69 | +xlings update |
| 70 | +xlings install mcpp@$V -y |
| 71 | +$(find "$XLINGS_HOME" -name mcpp -type f -path '*/bin/*' | head -1) --version |
| 72 | +``` |
| 73 | + |
| 74 | +**Index propagation is not instant.** `xim-pkgindex` reaches clients as a CDN |
| 75 | +artifact, not a git clone, so a freshly merged bump is invisible for a while |
| 76 | +(measured at ~5 min on 2026-07-30; the documented worst case is ~40 min). A |
| 77 | +clean-room that still reports the old `latest` has not failed — it has not caught |
| 78 | +up. `ci-fresh-install`'s `wait-index` job encodes exactly this with a bounded |
| 79 | +15-minute wait. |
| 80 | + |
| 81 | +## 4. The bootstrap pin: what it is, and when to bump it |
| 82 | + |
| 83 | +`.xlings.json`'s `[workspace].mcpp` is the **starting point of self-hosting** — |
| 84 | +the released mcpp that `xlings install mcpp` puts in the workspace so CI can build |
| 85 | +mcpp from source. Its only requirement is that it can build the **current** tree. |
| 86 | + |
| 87 | +**It does not have to move with every release.** The index retains every |
| 88 | +published version (105 entries at the time of writing, back to the 0.0.x series), |
| 89 | +so an older pin keeps resolving indefinitely — verified by installing a |
| 90 | +two-releases-old version against the current index. |
| 91 | + |
| 92 | +Bumping it anyway is reasonable and is what this repository does in practice: a |
| 93 | +green CI round on the bumped pin is a direct proof that the new release can build |
| 94 | +mcpp itself on every platform. Treat it as a *useful check*, not a prerequisite. |
| 95 | + |
| 96 | +**The one hard constraint is direction**: the pin must never name a version that |
| 97 | +is not yet installable. Bump it only after the release is published, mirrored, |
| 98 | +**and merged into xim-pkgindex** — otherwise every CI job fails with |
| 99 | +`package 'mcpp@<unreleased>' not found`. `check_version_pins.sh` enforces the |
| 100 | +weaker "never newer than the version being built"; the index condition is on you. |
| 101 | + |
| 102 | +## 5. `MCPP_PIN` is derived, and why that matters |
| 103 | + |
| 104 | +`ci-fresh-install.yml` used to carry a second hand-edited copy of the pin. It was |
| 105 | +never the same thing: `MCPP_PIN` is the version **under test** — always the newest |
| 106 | +published release — while `.xlings.json` is the version **bootstrapped from**. |
| 107 | + |
| 108 | +It is now derived once, by the `wait-index` job, from the releases API, and every |
| 109 | +install job consumes that single output. Two properties had to hold, and the |
| 110 | +hardcoded literal only bought the first: |
| 111 | + |
| 112 | +1. **The version must be explicit.** Bare `xlings install mcpp` resolves "newest |
| 113 | + in the runner's index copy", so a lagging runner silently tests an *older* |
| 114 | + binary and reports green. Naming the version makes a lagging index fail loudly |
| 115 | + with `version not found`. A derived string is every bit as explicit as a |
| 116 | + literal one. |
| 117 | +2. **The guard and the jobs must name the same version.** On 2026-07-21 they did |
| 118 | + not: the index guard reported "index tracks 0.0.102" while the jobs installed |
| 119 | + 0.0.100 ten seconds later, meeting an index whose floor was 0.0.101 (#265). |
| 120 | + The guard was already deriving the right answer and throwing it away. Feeding |
| 121 | + both from one value makes that disagreement structurally impossible. |
| 122 | + |
| 123 | +`check_version_pins.sh` fails if a literal `MCPP_PIN:` reappears. |
| 124 | + |
| 125 | +> **Correction.** Commit `3b1cb6b` ("bootstrap pin -> 2026.7.29.2") states *"the |
| 126 | +> index no longer serves .1"* and quotes `version '2026.7.29.1' not found`. That |
| 127 | +> diagnosis is wrong: `2026.7.29.1` installs fine from the current index. The real |
| 128 | +> cause was a **stale local index copy** — the same propagation lag described in |
| 129 | +> §3, seen from the other side. Nothing about a release removes older versions, |
| 130 | +> and no reasoning should be built on the idea that it does. |
| 131 | +
|
| 132 | +## 6. Checklist |
| 133 | + |
| 134 | +``` |
| 135 | +[ ] version bumped in mcpp.toml + fingerprint.cppm (one commit) |
| 136 | +[ ] CHANGELOG entry |
| 137 | +[ ] bash .github/tools/check_version_pins.sh |
| 138 | +[ ] merge to main, CI green |
| 139 | +[ ] gh workflow run release.yml --ref main |
| 140 | +[ ] release.yml green (4 builds + publish-ecosystem) |
| 141 | +[ ] mirrors serve all four platforms on BOTH hosts, sha256 recomputed |
| 142 | +[ ] merge the xim-pkgindex bump PR |
| 143 | +[ ] clean-room XLINGS_HOME: xlings install mcpp@<version> succeeds |
| 144 | +[ ] (optional) bump .xlings.json — only now, never earlier |
| 145 | +``` |
0 commit comments