Compare commits

..

1 Commits

Author SHA1 Message Date
wangjia 3aa63d6575 fix(ci): Windows 构建改用 C:\jiu-build 短路径,弃用 subst W: 映射
Deploy / build-windows (push) Successful in 1m41s
Deploy / build-linux-web (push) Failing after 14m36s
Deploy / build-macos (push) Successful in 33m24s
Deploy / release-deploy (push) Has been skipped
subst W: 因 cmd/MSYS 引号转义失败(报"找不到路径"),导致 W: 盘
未创建、cd /w/client 失败。改为将 client/ 复制到 System32 之外的
C:\jiu-build 构建,规避 WOW64 重定向,并用 PowerShell Compress-Archive 打包。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 00:23:09 +08:00
2 changed files with 28 additions and 27 deletions
+5
View File
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.0.5] - 2026-06-03
### 修复
- 修复 Windows CI 构建失败:放弃脆弱的 `subst W:` 路径映射,改为将 client/ 复制到 System32 之外的干净短路径(C:\jiu-build)构建,规避 WOW64 文件系统重定向
## [1.0.4] - 2026-05-30
### 新功能
+23 -27
View File
@@ -11,43 +11,39 @@ VER="${TAG#v}"
echo "==> compile-windows: version=${VER}"
# Sync Flutter pubspec version
# Sync Flutter pubspec version (done in the checkout, before copying out)
sed -i "s/^version:.*/version: ${VER}+1/" client/pubspec.yaml
# Build Flutter Windows
# Use subst to create a short path (W:) to avoid WOW64 redirection issue
# when workspace is under C:\Windows\System32\config\systemprofile
WORKSPACE_WIN=$(cygpath -w "$(pwd)")
echo "==> workspace: $WORKSPACE_WIN"
cmd //c "subst W: \"${WORKSPACE_WIN}\"" || true
# The Forgejo Windows runner checks out under
# C:\Windows\System32\config\systemprofile\.cache\act\...\hostexecutor
# Building there triggers WOW64 filesystem redirection (System32 -> SysWOW64)
# which breaks CMake/Flutter native paths. So copy the Flutter project to a
# clean short path OUTSIDE System32 and build there. This replaces the previous
# `subst W:` trick, which was fragile due to cmd/MSYS quoting.
BUILD_ROOT="/c/jiu-build"
BUILD_CLIENT="${BUILD_ROOT}/client"
cd /w/client
echo "==> copying client/ to ${BUILD_CLIENT}"
rm -rf "$BUILD_ROOT"
mkdir -p "$BUILD_ROOT"
cp -r client "$BUILD_CLIENT"
# Build (run from the clean path; pushd/popd avoids needing $() to save cwd)
pushd "$BUILD_CLIENT" > /dev/null
flutter create --platforms=windows . --project-name jiu_client
flutter build windows --release \
"--dart-define=BASE_URL=https://jiu.51yanmei.com" \
"--dart-define=PUBLIC_URL=https://jiu.51yanmei.com" \
"--dart-define=APP_VERSION=${TAG}"
cd /w
popd > /dev/null
cmd //c "subst W: /d" || true
# Package release folder into zip using Python (available on all platforms)
# Package the Release folder into dist/ using PowerShell Compress-Archive.
# Source is an absolute Windows path; destination is relative to the workspace.
mkdir -p dist
python3 - <<'PYEOF'
import zipfile, os
src = os.path.join('W:\\', 'client', 'build', 'windows', 'x64', 'runner', 'Release') if os.path.exists('W:\\') else os.path.join('client', 'build', 'windows', 'x64', 'runner', 'Release')
dst = os.path.join('dist', 'jiu-windows-x64.zip')
with zipfile.ZipFile(dst, 'w', zipfile.ZIP_DEFLATED) as zf:
for root, dirs, files in os.walk(src):
for fname in files:
fp = os.path.join(root, fname)
zf.write(fp, os.path.relpath(fp, src))
size = os.path.getsize(dst)
print(f'Packaged {dst} ({size // 1024 // 1024} MB)')
PYEOF
REL_WIN='C:\jiu-build\client\build\windows\x64\runner\Release'
echo "==> packaging ${REL_WIN} -> dist/jiu-windows-x64.zip"
powershell -NoProfile -Command \
"Compress-Archive -Path '${REL_WIN}\*' -DestinationPath 'dist\jiu-windows-x64.zip' -Force"
echo "==> compile-windows: done — dist/ contents:"
ls -lh dist/