aa7099ba94
将单一 CI/CD 流水线拆成三条互不影响的发布流水线,各有 tag 前缀、独立版本
序列与独立 CHANGELOG:
- client(client-v*):Flutter 全平台 + version.yaml 自更新清单
- site(site-v*):web/ Eleventy 营销站,不含 web 版 app
- server(server-v*):backend Go 服务 + 共享基建 nginx/systemd
新增 3 个 workflow(deploy-client/site/server.yml)替换 deploy.yml;CI 脚本
按 part 拆分为 compile-/release-/deploy-{client,site,server}.sh,抽出公共函数
lib-forgejo.sh;compile-{macos,android,ios,windows}.sh 改去 client-v 前缀;
manual.yml 按前缀路由回滚。
跨流水线解耦:version.yaml 归 client,后端每请求实时读取(不重启、不触发
server 流水线);官网下载页的版本徽章/下载链接/更新日志时间线运行时经
/api/v1/public/release 动态拉取(API 不可达回退构建时静态内容)。为此一次性
扩展后端 changelog 字段(version.go/public.go)与 download.njk 动态渲染。
CHANGELOG.md 重命名为 CHANGELOG-client.md,新增 CHANGELOG-site/server.md;
重写 /release 命令为 /release <part> [version];同步更新 CLAUDE.md 与部署文档。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
83 lines
3.5 KiB
Bash
Executable File
83 lines
3.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# compile-windows.sh <tag> — build Flutter Windows desktop, package into dist/
|
|
set -euo pipefail
|
|
|
|
# shellcheck source=scripts/ci/_env.sh
|
|
. "$(dirname "$0")/_env.sh"
|
|
|
|
TAG="$1"
|
|
VER="${TAG#client-v}"
|
|
|
|
echo "==> compile-windows: version=${VER}"
|
|
|
|
# Sync Flutter pubspec version (done in the checkout, before copying out)
|
|
sed -i "s/^version:.*/version: ${VER}+1/" client/pubspec.yaml
|
|
|
|
# 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"
|
|
|
|
echo "==> copying client/ to ${BUILD_CLIENT}"
|
|
rm -rf "$BUILD_ROOT"
|
|
mkdir -p "$BUILD_ROOT"
|
|
cp -r client "$BUILD_CLIENT"
|
|
|
|
# `cp -r` turns Flutter's plugin symlinks (windows/flutter/ephemeral/.plugin_symlinks/*)
|
|
# into real directories. flutter's createPluginSymlinks only cleans up *symlinks*, so it
|
|
# then fails to create a symlink over the copied real dir (errno 183 / PathExists).
|
|
# Drop all regenerable artifacts so the build below recreates them cleanly.
|
|
rm -rf "${BUILD_CLIENT}/windows/flutter/ephemeral" \
|
|
"${BUILD_CLIENT}/.dart_tool" \
|
|
"${BUILD_CLIENT}/build"
|
|
|
|
# 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=v${VER}"
|
|
popd > /dev/null
|
|
|
|
# Package the Release folder into a Windows installer with Inno Setup (ISCC).
|
|
# Inno Setup is installed by provision-windows.sh; check both Program Files dirs.
|
|
ISCC=""
|
|
for c in "/c/Program Files (x86)/Inno Setup 6/ISCC.exe" "/c/Program Files/Inno Setup 6/ISCC.exe"; do
|
|
if [ -f "$c" ]; then ISCC="$c"; break; fi
|
|
done
|
|
if [ -z "$ISCC" ]; then
|
|
echo "ERROR: Inno Setup (ISCC) not found. 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"
|
|
# 简体中文语言文件随 .iss 一起放到构建目录,供 [Languages] 按相对路径引用。
|
|
cp deploy/windows/ChineseSimplified.isl "${BUILD_ROOT}/ChineseSimplified.isl"
|
|
mkdir -p "${BUILD_ROOT}/dist"
|
|
echo "==> building installer with Inno Setup (version ${VER})"
|
|
# MSYS_NO_PATHCONV / MSYS2_ARG_CONV_EXCL disable Git Bash's automatic conversion
|
|
# of /-leading args into Windows paths, which otherwise mangles ISCC's /D defines
|
|
# (turning them into extra "script filenames").
|
|
MSYS_NO_PATHCONV=1 MSYS2_ARG_CONV_EXCL='*' "$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
|
|
echo "==> copying installer -> dist/jiu-windows-x64-setup.exe"
|
|
powershell -NoProfile -Command \
|
|
"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/
|