ci(windows): GitHub 云构建 Windows 安装器暂存 NAS + 发版可选来源(home/github)

家里 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
This commit is contained in:
wangjia
2026-07-18 07:08:48 +08:00
parent fd654f21ac
commit 0a54ded445
4 changed files with 189 additions and 22 deletions
+46 -1
View File
@@ -4,6 +4,16 @@ on:
push:
tags:
- 'client-v[0-9]*.[0-9]*.[0-9]*'
# 手动运行(在 tag 上 Run workflow)时可指定 Windows 构建来源,无需改仓库变量。
# 走 github 模式:选该版本的 tag 作为 ref 运行 + windows_source=github。
workflow_dispatch:
inputs:
windows_source:
description: 'Windows 构建来源:home=家里 runner(默认) / github=从 NAS 拉 GitHub 云构建'
required: false
default: home
type: choice
options: [home, github]
concurrency:
group: deploy-client
@@ -111,7 +121,11 @@ jobs:
APPSTORE_API_KEY_P8_BASE64: ${{ secrets.APPSTORE_API_KEY_P8_BASE64 }}
run: sh scripts/ci/compile-ios.sh "${{ gitea.ref_name }}"
# 默认:家里那台 Windows runner 构建(回家后照常用)。
# 仅当 gitea 仓库变量 WINDOWS_SOURCE=github 时跳过,改由 build-windows-ci 从 NAS 拉云构建。
build-windows:
# 来源判定:运行参数 windows_source 优先,其次仓库变量 WINDOWS_SOURCE,默认 home。
if: ${{ (github.event.inputs.windows_source || vars.WINDOWS_SOURCE || 'home') != 'github' }}
runs-on: windows
env:
GOPROXY: https://goproxy.cn,direct
@@ -135,8 +149,39 @@ jobs:
name: windows
path: dist/
# 特殊:家里 Windows 关机/连不上时,从 NAS 暂存拉 GitHub 云构建的安装器(版本强匹配)。
# 启用:gitea 仓库设变量 WINDOWS_SOURCE=github,并先在 GitHub 跑 windows.yml 构建该版本。
# 产出同名 windows artifact,下游 release-deploy-client 无需改动。
build-windows-ci:
if: ${{ (github.event.inputs.windows_source || vars.WINDOWS_SOURCE || 'home') == 'github' }}
runs-on: mac
steps:
- uses: actions/checkout@v4
- name: Fetch staged Windows installer from NAS
env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
FORGEJO_URL: ${{ secrets.FORGEJO_URL }}
GITEA_REPOSITORY: ${{ gitea.repository }}
run: sh scripts/ci/fetch-windows-staged.sh "${{ gitea.ref_name }}"
- name: Upload windows artifacts
uses: actions/upload-artifact@v3
with:
name: windows
path: dist/
release-deploy-client:
needs: [build-client-web, build-macos, build-android, build-ios, build-windows]
needs: [build-client-web, build-macos, build-android, build-ios, build-windows, build-windows-ci]
# 家里/云 两条 Windows 腿只会跑一条(另一条 skipped)。用 always() + 显式成功判定,
# 只要其中一条 windows 成功、且其余端全绿就继续发版。
if: |
always() &&
needs.build-client-web.result == 'success' &&
needs.build-macos.result == 'success' &&
needs.build-android.result == 'success' &&
needs.build-ios.result == 'success' &&
(needs.build-windows.result == 'success' || needs.build-windows-ci.result == 'success')
runs-on: mac
env:
GOPROXY: https://goproxy.cn,direct