From 3d1402bec87f0484a881bbd5f5b69925d3fda786 Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Sat, 18 Jul 2026 19:53:17 +0800 Subject: [PATCH] =?UTF-8?q?ci(deploy-client):=20=E6=94=B9=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E8=A7=A6=E5=8F=91(=E5=8E=BB=20tag=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8)=20+=20Windows=20=E5=90=88=E5=B9=B6=E4=B8=BA=E5=8D=95?= =?UTF-8?q?=E8=8A=82=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 去掉 push tags 自动触发,只留 workflow_dispatch(打 tag 只作标记,发版手动 Run workflow) ——弱网+gitea tag 事件飘忽下反复出重复 run/卡死,改手动可控 - build-windows + build-windows-ci 合并为单个 build-windows(runs-on 表达式选 runner + step if 决定家里现编/mac 拉 github),DAG 只显示一个节点 Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01P9G7E3wmAYL9KeYCVZVsqu --- .gitea/workflows/deploy-client.yml | 56 +++++++++--------------------- 1 file changed, 17 insertions(+), 39 deletions(-) diff --git a/.gitea/workflows/deploy-client.yml b/.gitea/workflows/deploy-client.yml index 55a828a..0f6dff4 100644 --- a/.gitea/workflows/deploy-client.yml +++ b/.gitea/workflows/deploy-client.yml @@ -1,11 +1,9 @@ name: Deploy Client +# 发版改为**手动触发**:打 tag 不再自动发版(tag 只作版本标记)。 +# 发版时在 gitea「Run workflow」选该版本的 tag 作为 ref 运行 + 选 windows_source。 +# (之前 push tags 自动触发在弱网/tag 事件飘忽下反复出重复 run、卡死,故改手动可控。) 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: @@ -121,12 +119,12 @@ 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 拉云构建。 + # Windows 单一 job(只显示一个节点)。按 windows_source 决定来源: + # home(默认) → 在家里 Windows runner 现编(provision + compile) + # github → 在 mac 上从 GitHub Release 拉云构建的安装器(免 frps;家里 Windows 关机时用) + # 来源判定:运行参数 windows_source 优先,其次仓库变量 WINDOWS_SOURCE,默认 home。 build-windows: - # 来源判定:运行参数 windows_source 优先,其次仓库变量 WINDOWS_SOURCE,默认 home。 - if: ${{ (github.event.inputs.windows_source || vars.WINDOWS_SOURCE || 'home') != 'github' }} - runs-on: windows + runs-on: ${{ (github.event.inputs.windows_source || vars.WINDOWS_SOURCE || 'home') == 'github' && 'mac' || 'windows' }} env: GOPROXY: https://goproxy.cn,direct PUB_HOSTED_URL: https://pub.flutter-io.cn @@ -135,30 +133,19 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Provision (idempotent — auto-runs if host not initialized) + # —— home 模式:家里 Windows runner 现编 —— + - name: Provision (home windows, idempotent) + if: ${{ (github.event.inputs.windows_source || vars.WINDOWS_SOURCE || 'home') != 'github' }} shell: bash run: sh scripts/ci/provision-windows.sh - - - name: Compile (Flutter Windows) + - name: Compile Flutter Windows (home) + if: ${{ (github.event.inputs.windows_source || vars.WINDOWS_SOURCE || 'home') != 'github' }} shell: bash run: sh scripts/ci/compile-windows.sh "${{ gitea.ref_name }}" - - name: Upload windows artifacts - uses: actions/upload-artifact@v3 - with: - name: windows - path: dist/ - - # 特殊:家里 Windows 关机/连不上时,从 GitHub Release 拉云构建的安装器(版本强匹配,免 frps)。 - # 启用: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 GitHub (免 frps) + # —— github 模式:mac 上从 GitHub Release 拉(免 frps)—— + - name: Fetch installer from GitHub (免 frps) + if: ${{ (github.event.inputs.windows_source || vars.WINDOWS_SOURCE || 'home') == 'github' }} env: GH_TOKEN: ${{ secrets.GH_TOKEN }} GH_REPO: bj-wangjia/jiu @@ -171,16 +158,7 @@ jobs: path: dist/ release-deploy-client: - 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') + needs: [build-client-web, build-macos, build-android, build-ios, build-windows] runs-on: mac env: GOPROXY: https://goproxy.cn,direct