Преглед на файлове

【修复,CI】自动升级后钩住触发 GHCR 发布

github-actions[bot] 用 GITHUB_TOKEN 推送的提交不触发 docker-build.yml 的 push 事件(GitHub 递归保护),导致自动升级后 GHCR 不更新。

在 docker-build.yml 增加 workflow_dispatch 触发器(手动触发 + API 被钩);upstream-check.yml 推送成功后用 gh workflow run 显式钩住发布,upgrade job 增加 actions: write 权限。
PJ568 преди 3 месеца
родител
ревизия
d79202ee6d
променени са 4 файла, в които са добавени 37 реда и са изтрити 5 реда
  1. 12 2
      .github/workflows/docker-build.yml
  2. 22 2
      .github/workflows/upstream-check.yml
  3. 1 0
      README.md
  4. 2 1
      README.zh.md

+ 12 - 2
.github/workflows/docker-build.yml

@@ -1,13 +1,23 @@
-# 自动构建并推送 GHCR:push master 触发
+# 自动构建并推送 GHCR:push master 或手动/workflow_dispatch 触发
 # 镜像 tag:latest + 日期时间 - 提交哈希(如 20260815T0054-a1b2c3d)
+# workflow_dispatch 提供两种钩入方式:
+#   - 手动:Actions 页面点「Run workflow」或 gh workflow run docker-build.yml
+#   - 被钩:upstream-check 自动升级推送后显式触发——bot 用 GITHUB_TOKEN 推送的提交不会触发
+#           push 事件(GitHub 递归保护),而 workflow_dispatch 是 GITHUB_TOKEN 的例外,总是创建 run
 #
-# Auto-build and push to GHCR: triggered on push to master
+# Auto-build and push to GHCR: triggered on push to master or manual/API dispatch
 # Image tags: latest + datetime-commit-hash (e.g. 20260815T0054-a1b2c3d)
+# workflow_dispatch offers two hook-in paths:
+#   - Manual: click "Run workflow" in the Actions tab or gh workflow run docker-build.yml
+#   - Hooked: upstream-check dispatches explicitly after an auto-upgrade push—commits pushed by
+#             the bot's GITHUB_TOKEN do not fire the push event (GitHub recursion protection),
+#             while workflow_dispatch is the GITHUB_TOKEN exception and always creates a run
 name: build-push-ghcr
 
 on:
   push:
     branches: [master]
+  workflow_dispatch:
 
 env:
   IMAGE: ghcr.io/xidong-ai/deepseek-harness-web-docker

+ 22 - 2
.github/workflows/upstream-check.yml

@@ -1,8 +1,13 @@
 # 定时检查 dsh 上游版本:有新版本 → 提升版本号 → 构建冒烟测试 → 通过则推送 master,失败则创建 Issue
-# 推送 master 会触发 docker-build.yml 自动构建 GHCR 镜像,形成「升级 → 发布」闭环
+# 推送后显式触发 docker-build.yml 发布 GHCR 镜像,形成「升级 → 发布」闭环
+# 注意:bot 用 GITHUB_TOKEN 推送的提交不会触发 docker-build.yml 的 push 事件(GitHub 递归保护),
+#       因此发布必须通过 workflow_dispatch API 显式钩住(该事件是 GITHUB_TOKEN 的例外,总是创建 run)
 #
 # Scheduled dsh upstream check: bump version on update → build & smoke test → push master on success, open an Issue on failure
-# Pushing to master triggers docker-build.yml, which builds GHCR images — an "upgrade → release" loop
+# After pushing, explicitly dispatch docker-build.yml to publish GHCR images — an "upgrade → release" loop
+# Note: commits pushed by the bot's GITHUB_TOKEN do NOT fire docker-build.yml's push event (GitHub
+#       recursion protection), so the release must be hooked explicitly via the workflow_dispatch
+#       API (the GITHUB_TOKEN exception that always creates a run)
 name: check-dsh-upstream
 
 on:
@@ -77,6 +82,7 @@ jobs:
     permissions:
       contents: write
       issues: write
+      actions: write
     steps:
       - uses: actions/checkout@v4
 
@@ -103,6 +109,20 @@ jobs:
         env:
           LATEST: ${{ needs.check.outputs.latest }}
 
+      # 钩住 GHCR 发布(见文件头注释)。continue-on-error:升级推送已成功,触发失败不应把 job
+      # 标记失败——否则 failure() 会误建「构建冒烟测试失败」Issue;触发失败可在日志中排查或手动触发
+      #
+      # Hook the GHCR release (see the file header). continue-on-error: the upgrade push already
+      # succeeded, so a dispatch failure must not fail the job—otherwise failure() would falsely
+      # open a "smoke test failed" Issue; a failed dispatch can be investigated in the log or
+      # triggered manually
+      - name: 触发 GHCR 发布(docker-build.yml)
+        continue-on-error: true
+        run: |
+          gh workflow run docker-build.yml --ref master
+        env:
+          GH_TOKEN: ${{ github.token }}
+
       # 升级已成功:旧版本的失败 Issue 均已过时,关闭以免陈旧累积
       # continue-on-error:清理失败不影响升级结果(不触发下方 failure() 步骤)
       #

+ 1 - 0
README.md

@@ -13,6 +13,7 @@ Containerized deployment of the [DeepSeek Harness](https://github.com/deepseek-a
 - Pinnable image version: build argument `DSH_VERSION`
 - CI automatically builds and pushes `ghcr.io/xidong-ai/deepseek-harness-web-docker` (latest + date-time-hash tags)
 - A scheduled CI job checks the dsh upstream daily: on a new version it bumps `DSH_VERSION`, builds and smoke-tests the image, pushes to master on success, or opens an Issue on failure (a failed version is not retried automatically while its Issue is open; manual dispatch bypasses the gate)
+- The GHCR release can be triggered manually (Actions tab → "Run workflow") or is hooked automatically after an upstream auto-upgrade (`workflow_dispatch`)
 
 ## Quick Start
 

+ 2 - 1
README.zh.md

@@ -12,7 +12,8 @@
 - 内置健康检查:`docker compose ps` 直接可见服务真实健康状态(带凭据穿透 basic auth 探测 dsh 响应,`starting`/`healthy`/`unhealthy`)
 - 镜像版本可 pin:构建参数 `DSH_VERSION`
 - CI 自动构建并推送 `ghcr.io/xidong-ai/deepseek-harness-web-docker`(latest + 日期时间 - 哈希 tag)
-- 定时任务每日检查 dsh 上游:有新版本自动提升 `DSH_VERSION`、构建并冒烟测试,通过则推送 master,失败则创建 Issue(存在同版本未关闭 Issue 时不再自动重试,可手动触发强制重试)
+- 定时任务每日检查 dsh 上游:有新版本自动提升 `DSH_VERSION`、构建并冒烟测试,通过则推送 master 并钩住触发 GHCR 发布,失败则创建 Issue(存在同版本未关闭 Issue 时不再自动重试,可手动触发强制重试)
+- GHCR 发布可手动触发(Actions 页「Run workflow」)或由上游升级自动钩住触发(`workflow_dispatch`)
 
 ## 快速开始