feat: 统一 Client 发布产物命名 (#102)

This commit is contained in:
chengma
2026-08-10 14:55:17 +08:00
parent 6fd25984d2
commit 240626f945
12 changed files with 119 additions and 25 deletions
+14 -1
View File
@@ -5,11 +5,24 @@ from __future__ import annotations
import argparse
import hashlib
import json
import re
from pathlib import Path
from typing import Any
MANIFEST_FILE_NAME = "autobuy——manifest.json"
MANIFEST_FILE_NAME = "autobuy_manifest.json"
_VERSION_PATTERN = re.compile(
r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*))?$"
)
def versioned_manifest_file_name(version: str) -> str:
"""返回版本化清单文件名,例如 ``autobuy_manifest_0.2.2.json``。"""
normalized = version.strip()
if _VERSION_PATTERN.fullmatch(normalized) is None:
raise ValueError("版本号必须是三段或四段非负整数")
return f"autobuy_manifest_{normalized}.json"
def file_description(path: Path) -> dict[str, Any]: