From e09391a286e5f652c0e8dea9835e460d6ab5a219 Mon Sep 17 00:00:00 2001 From: Syngnat Date: Wed, 13 May 2026 08:29:28 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(driver):=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E5=8D=95=E9=A9=B1=E5=8A=A8=E8=B5=84=E4=BA=A7=E4=BC=98=E5=85=88?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 发布流程:release/dev-build 同步输出单驱动 driver-agent 顶层资产 - 安装优化:复用现有直链优先逻辑,降低单驱动安装下载体积 - 兜底保留:继续生成 GoNavi-DriverAgents.zip 和索引文件 - 安全校验:新增驱动资产同名冲突检查,避免发布时静默覆盖 --- .github/workflows/dev-build.yml | 12 +++++++++++- .github/workflows/release.yml | 14 ++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 39de9ea..174a166 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -572,6 +572,7 @@ jobs: python3 - <<'PY' import json import os + import shutil import zipfile from pathlib import Path @@ -586,13 +587,21 @@ jobs: index_path.unlink() size_index = {} + standalone_assets = [] with zipfile.ZipFile(out_path, "w", compression=zipfile.ZIP_DEFLATED) as zf: - for p in base.rglob("*"): + for p in sorted(base.rglob("*")): if not p.is_file(): continue arcname = p.relative_to(base).as_posix() + if p.name in size_index: + raise RuntimeError(f"driver asset name conflict: {p.name}") zf.write(p, arcname) size_index[p.name] = p.stat().st_size + standalone_path = Path(p.name) + if standalone_path.exists(): + raise RuntimeError(f"release asset already exists: {standalone_path}") + shutil.copy2(p, standalone_path) + standalone_assets.append(standalone_path.name) index_path.write_text( json.dumps({"assets": size_index}, ensure_ascii=False, indent=2), @@ -601,6 +610,7 @@ jobs: print(f"created {out_name} size={out_path.stat().st_size} bytes") print(f"created {index_name} entries={len(size_index)}") + print(f"published standalone driver assets={len(standalone_assets)}") PY rm -rf drivers diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f7b910..6551e0a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -613,6 +613,7 @@ jobs: python3 - <<'PY' import json import os + import shutil import zipfile from pathlib import Path @@ -627,13 +628,21 @@ jobs: index_path.unlink() size_index = {} + standalone_assets = [] with zipfile.ZipFile(out_path, "w", compression=zipfile.ZIP_DEFLATED) as zf: - for p in base.rglob("*"): + for p in sorted(base.rglob("*")): if not p.is_file(): continue arcname = p.relative_to(base).as_posix() + if p.name in size_index: + raise RuntimeError(f"driver asset name conflict: {p.name}") zf.write(p, arcname) size_index[p.name] = p.stat().st_size + standalone_path = Path(p.name) + if standalone_path.exists(): + raise RuntimeError(f"release asset already exists: {standalone_path}") + shutil.copy2(p, standalone_path) + standalone_assets.append(standalone_path.name) index_path.write_text( json.dumps({"assets": size_index}, ensure_ascii=False, indent=2), @@ -642,9 +651,10 @@ jobs: print(f"created {out_name} size={out_path.stat().st_size} bytes") print(f"created {index_name} entries={len(size_index)}") + print(f"published standalone driver assets={len(standalone_assets)}") PY - # Release 只发布一个驱动总包,避免大量平铺资产污染 Release 页面 + # Release 同时发布单驱动资产与总包:应用优先下载单驱动,失败后仍可用总包兜底。 rm -rf drivers - name: Generate SHA256SUMS