Files
jiu/scripts/ci/provision-windows.sh
T
wangjia fba8b0a917
Deploy / build-linux-web (push) Successful in 51s
Deploy / build-macos (push) Successful in 57s
Deploy / build-windows (push) Failing after 1m22s
Deploy / release-deploy (push) Has been skipped
fix(ci): 健壮化 Inno Setup 安装 + 部署仅保留最新安装包
- 新增 install-innosetup.ps1:校验下载大小、检查安装程序退出码、双
  Program Files 目录定位 ISCC,修复原内联命令静默成功但没真正装上的问题
  (SYSTEM 账户下 Invoke-WebRequest 无 -UseBasicParsing + 未检查退出码)
- provision/compile-windows.sh 在两个 Program Files 目录查找 ISCC
- deploy.sh 发布安装包到 /opt/jiu/downloads 前先清旧包,仅保留最新版本

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 08:42:48 +08:00

61 lines
2.3 KiB
Bash

#!/usr/bin/env bash
# provision-windows.sh — idempotent provisioning for the Windows host runner.
#
# Pre-warms what compile-windows.sh would download at runtime: Flutter Windows
# engine artifacts, pub packages, and the Inno Setup compiler (ISCC) used to
# build the installer. The Flutter part short-circuits via a stamp keyed to the
# installed Flutter version; Inno Setup is ensured on every run (cheap when
# already present) so it self-heals independently of the Flutter stamp.
set -euo pipefail
SCRIPT_DIR="$(dirname "$0")"
# shellcheck source=scripts/ci/_env.sh
. "${SCRIPT_DIR}/_env.sh"
STAMP_DIR="${HOME}/.cache/jiu-ci"
STAMP="${STAMP_DIR}/provisioned-windows"
CUR="${STAMP_DIR}/.flutter-version-win.cur"
mkdir -p "$STAMP_DIR"
# --- ensure Inno Setup (ISCC) for building the installer (always checked) ---
# ISCC installs to Program Files (x86) (32-bit app); check both to be safe.
ISCC_X86="/c/Program Files (x86)/Inno Setup 6/ISCC.exe"
ISCC_X64="/c/Program Files/Inno Setup 6/ISCC.exe"
if [ ! -f "$ISCC_X86" ] && [ ! -f "$ISCC_X64" ]; then
echo "==> installing Inno Setup 6 (silent)"
# Robust installer (checks download size + installer exit code) — inline
# bash->powershell quoting was the original failure; a .ps1 avoids it.
powershell -NoProfile -ExecutionPolicy Bypass -File "${SCRIPT_DIR}/install-innosetup.ps1"
if [ ! -f "$ISCC_X86" ] && [ ! -f "$ISCC_X64" ]; then
echo "ERROR: Inno Setup install failed — ISCC not found." >&2
exit 1
fi
echo "==> Inno Setup installed."
fi
# --- detection (Flutter) ---
if ! command -v flutter >/dev/null 2>&1; then
echo "ERROR: flutter not found on PATH. Install Flutter on this runner first." >&2
exit 1
fi
flutter --version --machine > "$CUR" 2>/dev/null || flutter --version > "$CUR" 2>&1 || true
if [ -s "$STAMP" ] && cmp -s "$STAMP" "$CUR"; then
echo "==> provision-windows: already provisioned (Flutter unchanged), skipping."
exit 0
fi
echo "==> provision-windows: not provisioned (or Flutter changed) — running."
# --- warm Flutter Windows engine + pub deps ---
echo "==> precache Flutter engine (windows)"
flutter precache --windows
echo "==> flutter pub get (client)"
(cd "${SCRIPT_DIR}/../../client" && flutter pub get)
# --- mark provisioned ---
cp "$CUR" "$STAMP"
echo "==> provision-windows: done."
flutter --version | head -1