mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-22 08:50:17 +08:00
✨ feat(driver): 支持单驱动资产优先发布
- 发布流程:release/dev-build 同步输出单驱动 driver-agent 顶层资产 - 安装优化:复用现有直链优先逻辑,降低单驱动安装下载体积 - 兜底保留:继续生成 GoNavi-DriverAgents.zip 和索引文件 - 安全校验:新增驱动资产同名冲突检查,避免发布时静默覆盖
This commit is contained in:
12
.github/workflows/dev-build.yml
vendored
12
.github/workflows/dev-build.yml
vendored
@@ -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
|
||||
|
||||
14
.github/workflows/release.yml
vendored
14
.github/workflows/release.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user