feat(client): Windows 提供 Inno Setup 安装程序 + 下载改同源 HTTPS
Deploy / build-windows (push) Failing after 22s
Deploy / build-linux-web (push) Failing after 14m4s
Deploy / build-macos (push) Has been skipped
Deploy / release-deploy (push) Has been skipped

- Windows 客户端打成 jiu-windows-x64-setup.exe(Inno Setup,中文向导、
  桌面/开始菜单快捷方式、卸载项),替代解压版 zip
- provision-windows.sh 自动静默安装 Inno Setup(缺则装)
- 下载 URL 从内网 HTTP Forgejo 改为 https://jiu.51yanmei.com/downloads/,
  修复 HTTPS 页面下发 http 内网地址被浏览器拦截(无法安全下载),win/mac 均生效
- deploy.sh 将安装包发布到 EC2 /opt/jiu/downloads/,nginx 新增 /downloads/ 路由

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-04 07:46:41 +08:00
parent f039bd0c61
commit c001f0e8e6
7 changed files with 131 additions and 11 deletions
+23 -5
View File
@@ -44,13 +44,31 @@ flutter build windows --release \
"--dart-define=APP_VERSION=${TAG}"
popd > /dev/null
# Package the Release folder into dist/ using PowerShell Compress-Archive.
# Source is an absolute Windows path; destination is relative to the workspace.
# Package the Release folder into a Windows installer with Inno Setup (ISCC).
# Inno Setup is installed by provision-windows.sh.
ISCC="/c/Program Files (x86)/Inno Setup 6/ISCC.exe"
if [ ! -f "$ISCC" ]; then
echo "ERROR: Inno Setup (ISCC) not found at '$ISCC'. Run provision-windows.sh first." >&2
exit 1
fi
# Run ISCC entirely under the clean build root: 32-bit ISCC would hit WOW64
# redirection if it read the .iss / wrote output under the System32 workspace.
cp deploy/windows/jiu-installer.iss "${BUILD_ROOT}/jiu-installer.iss"
mkdir -p "${BUILD_ROOT}/dist"
echo "==> building installer with Inno Setup (version ${VER})"
"$ISCC" \
"/DAppVer=${VER}" \
"/DSrcDir=C:\\jiu-build\\client\\build\\windows\\x64\\runner\\Release" \
"/DOutDir=C:\\jiu-build\\dist" \
"C:\\jiu-build\\jiu-installer.iss"
# Copy the installer back to the workspace dist/ via PowerShell (64-bit, so it
# can write the System32 workspace path without WOW64 redirection).
mkdir -p dist
REL_WIN='C:\jiu-build\client\build\windows\x64\runner\Release'
echo "==> packaging ${REL_WIN} -> dist/jiu-windows-x64.zip"
echo "==> copying installer -> dist/jiu-windows-x64-setup.exe"
powershell -NoProfile -Command \
"Compress-Archive -Path '${REL_WIN}\*' -DestinationPath 'dist\jiu-windows-x64.zip' -Force"
"Copy-Item 'C:\\jiu-build\\dist\\jiu-windows-x64-setup.exe' 'dist\\jiu-windows-x64-setup.exe' -Force"
echo "==> compile-windows: done — dist/ contents:"
ls -lh dist/
+10
View File
@@ -90,6 +90,11 @@ rsync -avz --delete -e "ssh -i ~/.ssh/ec2_deploy.pem -o StrictHostKeyChecking=no
rsync -avz --delete -e "ssh -i ~/.ssh/ec2_deploy.pem -o StrictHostKeyChecking=no" \
/tmp/jiu-marketing-new/ "${EC2_USER}@${EC2_HOST}:/tmp/jiu-marketing-new/"
# Upload desktop client installers (served from /downloads/ by nginx).
# Guarded: may be absent in a partial manual deploy.
[ -f dist/jiu-windows-x64-setup.exe ] && ${SCP} dist/jiu-windows-x64-setup.exe "${EC2_USER}@${EC2_HOST}:/tmp/jiu-windows-x64-setup.exe" || true
[ -f dist/jiu-macos-x64.zip ] && ${SCP} dist/jiu-macos-x64.zip "${EC2_USER}@${EC2_HOST}:/tmp/jiu-macos-x64.zip" || true
echo "==> deploy: running remote deploy"
${SSH} "${EC2_USER}@${EC2_HOST}" << 'ENDSSH'
@@ -126,6 +131,11 @@ mkdir -p /opt/jiu/marketing
rsync -a --delete /tmp/jiu-marketing-new/ /opt/jiu/marketing/
rm -rf /tmp/jiu-marketing-new
# Publish desktop client installers to the nginx-served downloads dir
mkdir -p /opt/jiu/downloads
[ -f /tmp/jiu-windows-x64-setup.exe ] && mv -f /tmp/jiu-windows-x64-setup.exe /opt/jiu/downloads/ || true
[ -f /tmp/jiu-macos-x64.zip ] && mv -f /tmp/jiu-macos-x64.zip /opt/jiu/downloads/ || true
# Update jiu nginx config in the pangolin-edge reverse proxy.
# nginx now runs inside the `pangolin-edge` container (host networking), not on
# the host. Its /etc/nginx/conf.d is bind-mounted from the host dir below, so we
+22 -3
View File
@@ -2,8 +2,10 @@
# provision-windows.sh — idempotent provisioning for the Windows host runner.
#
# Pre-warms what compile-windows.sh would download at runtime: Flutter Windows
# engine artifacts and pub packages. Short-circuits via a stamp file keyed to
# the installed Flutter version, so repeat runs return immediately.
# 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")"
@@ -15,7 +17,24 @@ STAMP="${STAMP_DIR}/provisioned-windows"
CUR="${STAMP_DIR}/.flutter-version-win.cur"
mkdir -p "$STAMP_DIR"
# --- detection ---
# --- ensure Inno Setup (ISCC) for building the installer (always checked) ---
ISCC="/c/Program Files (x86)/Inno Setup 6/ISCC.exe"
if [ ! -f "$ISCC" ]; then
echo "==> installing Inno Setup 6 (silent)"
# Canonical "latest stable" entry point (redirects to the GitHub release asset).
INNO_URL="https://jrsoftware.org/download.php/is.exe"
powershell -NoProfile -Command \
"Invoke-WebRequest -Uri '${INNO_URL}' -OutFile \"\$env:TEMP\\innosetup.exe\""
powershell -NoProfile -Command \
"Start-Process -Wait -FilePath \"\$env:TEMP\\innosetup.exe\" -ArgumentList '/VERYSILENT','/SUPPRESSMSGBOXES','/NORESTART','/SP-'"
if [ ! -f "$ISCC" ]; then
echo "ERROR: Inno Setup install failed — ISCC not found at '$ISCC'." >&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
+7 -3
View File
@@ -44,9 +44,13 @@ notes = sys.argv[2]
tag = sys.argv[3]
furl = sys.argv[4].rstrip('/')
repo = sys.argv[5]
base = f"{furl}/{repo}/releases/download/{tag}"
# Public download URLs are served by jiu.51yanmei.com (same-origin HTTPS via the
# pangolin nginx /downloads/ location), NOT the LAN-only HTTP Forgejo instance —
# otherwise the HTTPS download page hands the browser an http://192.168.x URL and
# Chrome blocks it as insecure / it's unreachable from the public internet.
base = "https://jiu.51yanmei.com/downloads"
mac_url = f"{base}/jiu-macos-x64.zip"
win_url = f"{base}/jiu-windows-x64.zip"
win_url = f"{base}/jiu-windows-x64-setup.exe"
lines = []
with open('backend/config/version.yaml') as f:
@@ -128,6 +132,6 @@ upload_asset dist/web.tar.gz
upload_asset dist/marketing.tar.gz
upload_asset dist/configs.tar.gz
upload_asset dist/jiu-macos-x64.zip
upload_asset dist/jiu-windows-x64.zip
upload_asset dist/jiu-windows-x64-setup.exe
echo "==> release: done — Release ${TAG} created"