From 7a64e83ecf0d739e33288c1f91bdd7051ec1ee35 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Thu, 17 Sep 2026 00:12:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(build):=20build-linux.sh=20=E8=87=AA?= =?UTF-8?q?=E5=B7=B1=E9=87=8D=E6=96=B0=E7=94=9F=E6=88=90=E9=9A=8F=E5=8C=85?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=E4=B9=A6=EF=BC=8C=E4=B8=8D=E5=86=8D=E6=8A=8A?= =?UTF-8?q?=E6=97=A7=E6=96=87=E6=A1=A3=E6=89=93=E8=BF=9B=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 踩过一次:Linux 包内「升级说明.txt」停在 dev_0.5.2,而源码已经走到 0.5.11。 根因是脚本只 **拷** console/extra/*.txt(那些是 deploy/prepare-extra.mjs 的产物), 自己从不重新生成 —— 于是把「上一次生成时的旧说明书」原样打进了包。 (Windows 侧不受影响:build.bat 里有这一步,所以那边一直是新的。) 现在脚本在摆随包文件之前先跑一次 node deploy/prepare-extra.mjs; 生成失败**不阻断**构建(Linux 包不该因为说明书而失败),但打印一行警告, 避免以后又静默发一份旧文档出去。 已验证:重跑脚本后,包内「升级说明.txt」的最新节是 ## dev_0.5.11。 --- deploy/build-linux.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/deploy/build-linux.sh b/deploy/build-linux.sh index 8668e4f..ac1d85c 100755 --- a/deploy/build-linux.sh +++ b/deploy/build-linux.sh @@ -105,8 +105,15 @@ cp -a "$ROOT/console/config.json" "$STAGE/config.json" cp -a "$ROOT/console/scoreboard.png" "$STAGE/scoreboard.png" cp -a "$ROOT/rules" "$STAGE/rules" # 说明书之类平铺在包根(extraFiles 的 from: extra, to: .)。 -# 这些 .txt 是 deploy/prepare-extra.mjs 从 docs/ 生成到 console/extra/ 的,本脚本不重新生成, -# 只负责把它们放进包里;没有就跳过(Linux 包不该因为没有说明书而构建失败)。 +# ⚠️ 这些 .txt 由 deploy/prepare-extra.mjs 从 docs/ 生成,**必须在这里现场重新生成一次**: +# 只拷现成的,包里就会带上"上一次生成时的旧说明书"——已经踩过一次: +# 包内「升级说明.txt」停在 dev_0.5.2,而源码已经走到 0.5.11。 +# 生成失败**不阻断**构建(Linux 包不该因为说明书而失败),但打印一行警告,别静默发旧文档。 +if [ -f "$ROOT/deploy/prepare-extra.mjs" ] && command -v node >/dev/null 2>&1; then + if ! (cd "$ROOT" && node deploy/prepare-extra.mjs >/dev/null 2>&1); then + echo " ⚠️ 随包说明书重新生成失败(node deploy/prepare-extra.mjs),包里可能仍是旧版" >&2 + fi +fi if [ -d "$ROOT/console/extra" ]; then find "$ROOT/console/extra" -maxdepth 1 -type f ! -name '.gitkeep' -exec cp -a {} "$STAGE/" \; fi