|
|
|
@@ -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/
|
|
|
|
|