feat(ci): 版本记录检查(四节 + 正式 tag 一致性)+ 只读发版预检

check_changelog.py:正式版本条目必须四节齐备且非空(改了什么/兼容性与迁移影响/怎么验收/已知问题)、版本号三段无前导零、[Unreleased] 在最上面;新增 --tags 核对正式 tag(必须注释 tag)与它指到那个提交里的版本记录一致。只有 Unreleased 的新工程放行;没有正式 tag 不判红(开发版本不打 tag 是常态)。ci_checks.py:新增必需检查 version(门禁 15 项),策略版本 ci-checks/2。ci_checkout.sh:记录远端 tag 清单并取 tag 对象供核对。release_preflight.py:只读预检(版本建议/完整 SHA/CI 证据/CHANGELOG/远端 tag 与 Release/遗留项),写类 git 命令与 POST 在预检路径上被拒(--self-test 证明);批准后 --execute 才打注释 tag、推 tag、建 Release 并读回。CHANGELOG 0.1.0 补上原本缺的两节。
This commit is contained in:
姚章浩
2026-10-12 17:57:43 +08:00
parent 9ad13a8c62
commit 40d84994cb
6 changed files with 632 additions and 48 deletions
+4 -1
View File
@@ -37,7 +37,7 @@ from typing import Callable
ROOT = Path(__file__).resolve().parent.parent
WEB = ROOT / "web"
REPORT_DEFAULT = ROOT / "ci-report.json"
POLICY_REVISION = "ci-checks/1" # 判据变更时改这里,报告里跟着变
POLICY_REVISION = "ci-checks/2" # 判据变更时改这里,报告里跟着变
MANIFESTS = ["go.mod", "go.sum", "web/package.json", "web/package-lock.json"]
SUCCESS, FAILURE, SKIPPED, NOT_RUN = "success", "failure", "skipped", "not_run"
@@ -251,6 +251,8 @@ def checks() -> list[Check]:
[py3, "scripts/ci_checks.py", "--internal-web-test"], env=env),
Check("contracts", "版本与变更记录契约(不许 SKIP 后算过)",
[py3, "scripts/ci_checks.py", "--internal-contracts", g], env=env),
Check("version", "CHANGELOG 与版本记录(四节齐备 + 正式 tag 与提交内版本一致)",
[py3, "scripts/check_changelog.py", "--tags"]),
Check("security-secrets", "密钥泄漏扫描(含扫描器自检)",
[py3, "scripts/check_secrets.py"]),
Check("security-deps", "依赖漏洞(govulncheck + npm audit,分级 + 例外)",
@@ -389,6 +391,7 @@ CHECK_MANIFEST: dict[str, tuple[str, ...]] = {
"tests-go": ("local", "ci"),
"tests-web": ("local", "ci"),
"contracts": ("local", "ci"),
"version": ("local", "ci"),
"security-secrets": ("local", "ci"),
"security-deps": ("local", "ci"),
"manifests-locked": ("local", "ci"),