fix(release): verify TUI materials before tagging
This commit is contained in:
1 parent
ea630c7303
commit
d24ae06117
5 files changed
+111
-15
No files matched your search
+9
-4
@@ -144,10 +144,15 @@ documentation coordination, and the final publication handoff.
|
||||
A stable install must never combine Python from one version with a TUI from another. Publish in
|
||||
this order:
|
||||
|
||||
1. Set the package version and publish the matching GitHub release tag (`vX.Y.Z`).
|
||||
2. Review the pinned Bun/OpenTUI licenses, source offer, and relinking materials for that tag.
|
||||
3. Manually run **Publish Terminal UI** for the exact tag and confirm the compliance review input.
|
||||
4. Wait for every platform archive and checksum to appear on the release, then publish the same
|
||||
1. Before pushing a tag, set the package version, verify the exact candidate, build both Python
|
||||
distributions and all five TUI archives, and review licenses, source offer, and relinking
|
||||
materials. Obtain the maintainer's source-offer commitment before publication.
|
||||
2. Merge the release preparation, verify that its packaged sources match the checked candidate,
|
||||
then publish the matching GitHub release tag (`vX.Y.Z`). Recheck any changed sources first.
|
||||
3. Attach the preverified TUI archives and checksums to the matching GitHub Release. Alternatively,
|
||||
manually run **Publish Terminal UI** for the exact tag with the compliance review confirmed;
|
||||
reverify its outputs, since a rebuild does not preserve the preflight artifact hashes.
|
||||
4. Verify every platform archive and checksum is publicly downloadable, then publish the same
|
||||
`X.Y.Z` package to PyPI.
|
||||
|
||||
The wheel contains the built WebUI. The native TUI stays a platform-specific release sidecar so
|
||||
|
||||
+44
-8
@@ -25,23 +25,59 @@ uploading to PyPI, and deploying the documentation are separate operations.
|
||||
7. Prepare the matching documentation PR in `Re-bin/nanobot-web`, following its
|
||||
`MAINTAINING.md`. Review English and all nine translations, preserve Nightly and previous
|
||||
releases, update the latest-version redirects, and run the complete site quality gate.
|
||||
Candidate docs may be prepared from a commit, but must be checked against the final tag.
|
||||
Pin source links to the checked candidate commit; confirm those source files match the
|
||||
eventual tag before deploying. Never advertise an unpublished version as publicly available.
|
||||
8. Review the pinned Bun/OpenTUI licenses, corresponding-source materials, and relinking
|
||||
instructions now, not after pushing the tag. Verify the exact upstream revisions are
|
||||
retrievable and the runtime versions match the lockfile and notices. Obtain the maintainer's
|
||||
commitment to honor `tui/SOURCE_OFFER.md` for its entire stated period; tests cannot grant it.
|
||||
9. Build all five native TUI targets using the same scripts as the publication workflow.
|
||||
Include ad-hoc signatures for macOS before packaging. Verify every archive's checksum,
|
||||
manifest, executable architecture, required notices/licenses, and embedded source contents.
|
||||
Run platform-specific smoke tests where supported; record cross-compiled-only targets as
|
||||
such and link exact-head CI evidence instead of claiming native execution everywhere.
|
||||
10. Merge the release-preparation PR only after its current checks and reviews pass. Confirm the
|
||||
merged source tree matches the tested candidate; if it does not, rebuild and recheck before
|
||||
tagging. Reconcile the final changelog and documentation source references. The tag must
|
||||
point to this verified commit, not an unchecked later `main` tip.
|
||||
|
||||
### TUI preflight without a release tag
|
||||
|
||||
Use Bun 1.3.13 and a clean checkout. The local build and packaging scripts do not require a
|
||||
tag or GitHub Release. Run targets sequentially because native dependency preparation modifies
|
||||
the shared `node_modules` directory:
|
||||
|
||||
```bash
|
||||
cd tui
|
||||
bun install --frozen-lockfile
|
||||
bun scripts/prepare-target.ts <target>
|
||||
bun run build -- <target>
|
||||
# For darwin-* only: ad-hoc sign dist/nanobot-tui-<target> before the next steps.
|
||||
bun scripts/release-notices.ts <target>
|
||||
python3 scripts/package-release.py <target>
|
||||
```
|
||||
|
||||
Repeat for `darwin-arm64`, `darwin-x64`, `linux-arm64`, `linux-x64`, and `win32-x64`.
|
||||
On macOS, use `codesign --force --sign - <binary>` and verify the signature. The publication
|
||||
workflow uses pinned `rcodesign` on Linux. Keep the ten `.zip`/`.zip.sha256` outputs in a
|
||||
candidate-specific directory, alongside the two Python distributions and provenance manifest.
|
||||
Do not include local configuration, instance backups, or test environments in upload selections.
|
||||
|
||||
Keep an artifact manifest with the source commit, version, filenames, hashes, checks performed,
|
||||
and any remaining release gates. Rebuild and recheck if the packaged source changes.
|
||||
|
||||
## Publish, with maintainer approval
|
||||
|
||||
1. Merge the release-preparation PR and confirm the final commit. Create and push exactly
|
||||
1. Confirm all pre-tag gates above are complete. Create and push exactly
|
||||
`vX.Y.Z`; do not move or reuse a published version tag.
|
||||
2. Create the matching GitHub Release. A draft may be used while assembling its attachments.
|
||||
Pushing the tag alone does not run `Publish Terminal UI` or upload anything to PyPI.
|
||||
3. Review the pinned Bun/OpenTUI licenses, corresponding-source materials, source-offer
|
||||
commitment, and relinking instructions for that exact tag. Only then confirm the
|
||||
compliance input and manually run **Publish Terminal UI** with `tag=vX.Y.Z`.
|
||||
4. Wait for all five targets: macOS arm64/x64, Linux arm64/x64, and Windows x64. Each needs
|
||||
its release archive and `.sha256` file. Check the archive contents required by the
|
||||
packaging contract. A successful build is not a substitute for compliance review.
|
||||
3. Attach the already verified five TUI archives and their `.sha256` files, after confirming
|
||||
the tag's packaged sources match the artifact manifest. Verify the uploaded bytes match
|
||||
their preflight hashes; never upload a naked executable.
|
||||
4. If instead rebuilding through **Publish Terminal UI**, use `tag=vX.Y.Z` and confirm the
|
||||
already completed compliance review. Wait for all five targets and repeat artifact checks
|
||||
on those new outputs. Do not substitute their new bytes under the old artifact hashes.
|
||||
5. Make the GitHub Release and all TUI attachments publicly available. Verify their public
|
||||
downloads before publishing Python, since installed clients fetch version-matched assets.
|
||||
6. Upload only the checked `nanobot_ai-X.Y.Z.tar.gz` and `nanobot_ai-X.Y.Z-py3-none-any.whl`
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
"""Keep shipped relinking instructions aligned with the pinned TUI runtime."""
|
||||
|
||||
import importlib.util
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
SPEC = importlib.util.spec_from_file_location("package_release", ROOT / "tui/scripts/package-release.py")
|
||||
assert SPEC is not None and SPEC.loader is not None
|
||||
packager = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(packager)
|
||||
|
||||
|
||||
def test_current_relinking_matches_pinned_opentui():
|
||||
root = ROOT / "tui"
|
||||
version = json.loads((root / "package.json").read_text())["dependencies"]["@opentui/core"]
|
||||
packager._validate_opentui_version(root, f"===== @opentui/core {version} (MIT) =====")
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("version", "relinking", "notices", "error"),
|
||||
[
|
||||
("^0.5.10", "0.5.10", "0.5.10", "exact release version"),
|
||||
("0.5.10", "0.5.3", "0.5.10", "RELINKING.md"),
|
||||
("0.5.10", "0.5.10", "0.5.3", "third-party notices"),
|
||||
],
|
||||
)
|
||||
def test_rejects_stale_runtime_materials(tmp_path, version, relinking, notices, error):
|
||||
(tmp_path / "package.json").write_text(json.dumps({"dependencies": {"@opentui/core": version}}))
|
||||
(tmp_path / "RELINKING.md").write_text(
|
||||
f"OpenTUI {relinking}: <https://www.npmjs.com/package/@opentui/core/v/{relinking}>"
|
||||
)
|
||||
with pytest.raises(ValueError, match=error):
|
||||
packager._validate_opentui_version(tmp_path, f"===== @opentui/core {notices} (MIT) =====")
|
||||
+3
-2
@@ -2,7 +2,7 @@
|
||||
|
||||
The nanobot TUI release archive contains the executable, its complete JavaScript/TypeScript
|
||||
application source, dependency lockfile, build scripts, and third-party notices. It is built with
|
||||
Bun 1.3.13 and OpenTUI 0.5.3. See `SOURCE_OFFER.md` for the corresponding-source
|
||||
Bun 1.3.13 and OpenTUI 0.5.10. See `SOURCE_OFFER.md` for the corresponding-source
|
||||
offer that accompanies the executable. The archive also contains the complete LGPL 2.0 and
|
||||
LGPL 2.1 license texts.
|
||||
|
||||
@@ -13,7 +13,8 @@ Corresponding upstream source:
|
||||
<https://github.com/oven-sh/bun/tree/bun-v1.3.13>
|
||||
- Bun's patched WebKit (`4d5e75ebd84a14edbc7ae264245dcd77fe597c10`):
|
||||
<https://github.com/oven-sh/WebKit/tree/4d5e75ebd84a14edbc7ae264245dcd77fe597c10>
|
||||
- OpenTUI 0.5.3: <https://www.npmjs.com/package/@opentui/core/v/0.5.3>
|
||||
- OpenTUI 0.5.10: <https://www.npmjs.com/package/@opentui/core/v/0.5.10>
|
||||
(source: <https://github.com/anomalyco/opentui/tree/f6673a04ccb671b9207da358c57152bfd27c781f>)
|
||||
|
||||
To rebuild against a modified JavaScriptCore/WebKit, first build Bun 1.3.13 from its complete
|
||||
source checkout together with the WebKit revision above by following Bun's pinned license and
|
||||
|
||||
@@ -4,6 +4,8 @@ from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import io
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
import tarfile
|
||||
import zipfile
|
||||
@@ -22,6 +24,20 @@ def _sha256(data: bytes) -> str:
|
||||
return hashlib.sha256(data).hexdigest()
|
||||
|
||||
|
||||
def _validate_opentui_version(root: Path, notices: str) -> None:
|
||||
version = json.loads((root / "package.json").read_text())["dependencies"]["@opentui/core"]
|
||||
if not re.fullmatch(r"\d+\.\d+\.\d+", version):
|
||||
raise ValueError("OpenTUI must be pinned to an exact release version")
|
||||
relinking = (root / "RELINKING.md").read_text()
|
||||
if (
|
||||
set(re.findall(r"OpenTUI (\d+\.\d+\.\d+)", relinking)) != {version}
|
||||
or f"https://www.npmjs.com/package/@opentui/core/v/{version}>" not in relinking
|
||||
):
|
||||
raise ValueError(f"RELINKING.md must describe OpenTUI {version}")
|
||||
if f"===== @opentui/core {version} (" not in notices:
|
||||
raise ValueError(f"third-party notices must describe OpenTUI {version}")
|
||||
|
||||
|
||||
def _source_archive(root: Path) -> bytes:
|
||||
included = [
|
||||
"README.md",
|
||||
@@ -61,10 +77,12 @@ def main() -> None:
|
||||
extension = ".exe" if target.startswith("win32-") else ""
|
||||
asset = f"nanobot-tui-{target}{extension}"
|
||||
dist = root / "dist"
|
||||
notices = (dist / f"{asset}.THIRD_PARTY_NOTICES.txt").read_bytes()
|
||||
_validate_opentui_version(root, notices.decode("utf-8"))
|
||||
|
||||
files = {
|
||||
asset: (dist / asset).read_bytes(),
|
||||
"THIRD_PARTY_NOTICES.txt": (dist / f"{asset}.THIRD_PARTY_NOTICES.txt").read_bytes(),
|
||||
"THIRD_PARTY_NOTICES.txt": notices,
|
||||
"RELINKING.md": (root / "RELINKING.md").read_bytes(),
|
||||
"SOURCE_OFFER.md": (root / "SOURCE_OFFER.md").read_bytes(),
|
||||
"LICENSE": (project_root / "LICENSE").read_bytes(),
|
||||
|
||||
Reference in new issue
Block a user