0a54ded445
家里 Windows runner 关机时的备用构建源。 - windows.yml: 构建 Inno 安装器(复用 compile-windows.sh)→ 暂存 NAS gitea winstage-v<版本> - deploy-client.yml: build-windows 加 home/github 开关(参数 windows_source 优先,变量 WINDOWS_SOURCE 兜底),新增 build-windows-ci 从 NAS 按版本拉取 - stage/fetch 脚本: 版本强匹配,拉不到硬失败 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P9G7E3wmAYL9KeYCVZVsqu
74 lines
2.8 KiB
YAML
74 lines
2.8 KiB
YAML
name: Build & Stage Windows (jiu client)
|
||
|
||
# GitHub 云构建 Windows 桌面安装器(Inno),并暂存到 NAS gitea 的 winstage-v<版本>。
|
||
# 用途:家里那台 Windows runner 关机/连不上时的备用构建源。发版时把 gitea 仓库变量
|
||
# WINDOWS_SOURCE 设为 github,deploy-client 就会按同版本从 NAS 拉这里暂存的安装器。
|
||
# 版本匹配:workflow_dispatch 填 ver(发版要 tag 的版本);push 触发则取 client/pubspec.yaml。
|
||
on:
|
||
workflow_dispatch:
|
||
inputs:
|
||
ver:
|
||
description: '版本号 (如 1.2.3;留空取 client/pubspec.yaml)。暂存到 winstage-v<版本>,发版按同版本拉取。'
|
||
required: false
|
||
default: ''
|
||
push:
|
||
branches: [ main ]
|
||
paths:
|
||
- 'client/**'
|
||
- '.github/workflows/windows.yml'
|
||
- 'scripts/ci/compile-windows.sh'
|
||
- 'deploy/windows/**'
|
||
|
||
jobs:
|
||
build-stage-windows:
|
||
runs-on: windows-latest
|
||
env:
|
||
# 覆盖 _env.sh 的中国镜像默认值:GitHub runner 在美国,用国际源更快更稳。
|
||
PUB_HOSTED_URL: https://pub.dev
|
||
FLUTTER_STORAGE_BASE_URL: https://storage.googleapis.com
|
||
GOPROXY: https://proxy.golang.org,direct
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
|
||
- uses: subosito/flutter-action@v2
|
||
with:
|
||
channel: stable
|
||
|
||
- run: flutter config --enable-windows-desktop
|
||
|
||
- name: Install Inno Setup (idempotent)
|
||
shell: pwsh
|
||
run: powershell -NoProfile -ExecutionPolicy Bypass -File scripts/ci/install-innosetup.ps1
|
||
|
||
- name: Resolve version
|
||
id: ver
|
||
shell: bash
|
||
run: |
|
||
v="${{ inputs.ver }}"
|
||
if [ -z "$v" ]; then
|
||
v=$(grep -E '^version:' client/pubspec.yaml | head -1 | sed -E 's/^version:[[:space:]]*//; s/\+.*//')
|
||
fi
|
||
echo "ver=$v" >> "$GITHUB_OUTPUT"
|
||
echo "解析版本: $v"
|
||
|
||
# 复用与家里 runner 完全相同的构建脚本 → 产出 dist/jiu-windows-x64-setup.exe,
|
||
# 保证云构建与家里构建出的安装器一致(BASE_URL/PUBLIC_URL=https://jiu.51yanmei.com)。
|
||
- name: Build Windows installer (Inno)
|
||
shell: bash
|
||
run: bash scripts/ci/compile-windows.sh "client-v${{ steps.ver.outputs.ver }}"
|
||
|
||
- name: Upload installer artifact (GitHub 备份,可直接下载)
|
||
uses: actions/upload-artifact@v4
|
||
with:
|
||
name: jiu-windows-x64-setup
|
||
path: dist/jiu-windows-x64-setup.exe
|
||
if-no-files-found: error
|
||
|
||
- name: Stage installer → NAS gitea (winstage-v<版本>)
|
||
shell: bash
|
||
env:
|
||
FORGEJO_URL: ${{ secrets.FORGEJO_URL }}
|
||
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
|
||
GITEA_REPOSITORY: ${{ vars.GITEA_REPOSITORY || 'wangjia/jiu' }}
|
||
run: bash scripts/ci/stage-windows-forgejo.sh "client-v${{ steps.ver.outputs.ver }}"
|