diff --git a/scripts/ci/compile-windows.sh b/scripts/ci/compile-windows.sh index 9f18390..aaacbfb 100755 --- a/scripts/ci/compile-windows.sh +++ b/scripts/ci/compile-windows.sh @@ -51,7 +51,15 @@ VER="" read -r VER < "$ver_file" || true # 无结尾换行的 read 退出码,见 compile-android.sh 同注释 rm -f "$ver_file" -echo "==> compile-windows: tag=${TAG} version=${VER}" +# build number 同 android/macos 规则(MAJOR*10000+MINOR*100+PATCH)。 +MAJOR="${VER%%.*}" +_REST="${VER#*.}" +MINOR="${_REST%%.*}" +PATCH="${_REST#*.}" +PATCH="${PATCH%%-*}" +BUILD=$(( MAJOR * 10000 + MINOR * 100 + PATCH )) + +echo "==> compile-windows: tag=${TAG} version=${VER} build=${BUILD}" API_URL="${PANGOLIN_API_URL:-https://api.yanmeiai.com}" @@ -79,6 +87,12 @@ rm -rf "${BUILD_CLIENT}/windows/flutter/ephemeral" \ "${BUILD_CLIENT}/.dart_tool" \ "${BUILD_CLIENT}/build" +# 同步 Flutter app 版本到 tag(GNU sed,windows runner)。否则 package_info 卡在 +# pubspec committed 值(1.0.48),设置页显示旧版 + 自动更新永远判"有新版"。 +# 此前只改了 Inno 安装器 MyAppVersion(下方),App 内部版本没跟上——本次修复。 +sed -i "s/^version:.*/version: ${VER}+${BUILD}/" "${BUILD_CLIENT}/pubspec.yaml" +echo "==> compile-windows: pubspec version -> ${VER}+${BUILD}" + # ── [3/4] build ────────────────────────────────────────────────────────────── # NOTE(controller): `flutter create` on an existing project only fills in # scaffolding it manages (ephemeral/, generated_plugins.cmake, ...) and should