Files
jiu/scripts/ci/compile-windows.sh
T
wangjia b3f5a0f083
Deploy / build-windows (push) Failing after 30s
Deploy / build-linux-web (push) Successful in 1m2s
Deploy / build-macos (push) Failing after 14m5s
Deploy / release-deploy (push) Has been skipped
debug(ci): 添加 Windows 构建目录诊断输出
2026-06-01 01:13:48 +08:00

51 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# compile-windows.sh <tag> — build Flutter Windows desktop, package into dist/
set -euo pipefail
export GOPROXY="${GOPROXY:-https://goproxy.cn,direct}"
export PUB_HOSTED_URL="${PUB_HOSTED_URL:-https://pub.flutter-io.cn}"
export FLUTTER_STORAGE_BASE_URL="${FLUTTER_STORAGE_BASE_URL:-https://storage.flutter-io.cn}"
TAG="$1"
VER="${TAG#v}"
echo "==> compile-windows: version=${VER}"
# Sync Flutter pubspec version
sed -i "s/^version:.*/version: ${VER}+1/" client/pubspec.yaml
# Build Flutter Windows
cd client
echo "==> pwd: $(pwd)"
echo "==> windows/ before create: $(test -d windows && echo EXISTS || echo MISSING)"
flutter create --platforms=windows . --project-name jiu_client
echo "==> windows/ after create: $(test -d windows && echo EXISTS || echo MISSING)"
echo "==> windows/CMakeLists.txt: $(test -f windows/CMakeLists.txt && echo EXISTS || echo MISSING)"
ls windows/ 2>&1 || echo "(ls failed)"
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 ..
# Package release folder into zip using Python (available on all platforms)
mkdir -p dist
python3 - <<'PYEOF'
import zipfile, os
src = 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
echo "==> compile-windows: done — dist/ contents:"
ls -lh dist/