5eec510f1e
Design Source Checks / design-source (push) Failing after 4m4s
Deploy Client / build-client-web (push) Successful in 5m3s
Deploy Client / build-windows-ci (push) Successful in 4m57s
Deploy Client / build-macos (push) Failing after 4m38s
Deploy Client / build-android (push) Has been skipped
Deploy Client / build-ios (push) Has been skipped
Deploy Client / build-windows (push) Has been cancelled
Deploy Client / release-deploy-client (push) Has been cancelled
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01P9G7E3wmAYL9KeYCVZVsqu
93 lines
3.9 KiB
YAML
93 lines
3.9 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/**'
|
||
|
||
permissions:
|
||
contents: write # 允许内置 GITHUB_TOKEN 创建 Release(winstage-v<版本>)
|
||
|
||
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
|
||
|
||
# 发布到 GitHub Release winstage-v<版本> —— 发版时 mac-runner 从这里(github.com)拉,
|
||
# 不走 ali frps(off-LAN 时 NAS 经 frps 太慢/易断)。用内置 GITHUB_TOKEN,免额外密钥。
|
||
- name: Publish installer → GitHub Release (winstage-v<版本>,供 mac-runner 免 frps 拉取)
|
||
shell: bash
|
||
env:
|
||
GH_TOKEN: ${{ github.token }}
|
||
run: |
|
||
tag="winstage-v${{ steps.ver.outputs.ver }}"
|
||
gh release delete "$tag" -R "${{ github.repository }}" --yes --cleanup-tag 2>/dev/null || true
|
||
gh release create "$tag" -R "${{ github.repository }}" \
|
||
--title "$tag" --notes "Windows 安装器暂存(供 deploy-client 免 frps 拉取)" \
|
||
dist/jiu-windows-x64-setup.exe
|
||
|
||
# NAS 暂存仅作最佳努力的记录(发版实际从 GitHub Release 拉,见 fetch-windows-staged.sh)。
|
||
# 经 ali frps 上传易失败,不让它 fail 整个构建。
|
||
- name: Stage installer → NAS gitea (best-effort 记录)
|
||
continue-on-error: true
|
||
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 }}"
|