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
@@ -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