Skip to content

fix(release): gh-pages bootstrap on first run (closes #5) - #6

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/gh-pages-bootstrap
May 15, 2026
Merged

fix(release): gh-pages bootstrap on first run (closes #5)#6
github-actions[bot] merged 1 commit into
mainfrom
fix/gh-pages-bootstrap

Conversation

@libz-renlab-ai

Copy link
Copy Markdown
Owner

fix(release): gh-pages bootstrap on first run (closes #5)

PR #2 合主分支后,release-branch.yml 首次端到端跑(commit 1c23fde)在 step 14「Publish latest.json to gh-pages」挂了:

+ git clone -q --branch gh-pages ...
fatal: Remote branch gh-pages not found in upstream origin
##[error]Process completed with exit code 128.

本仓库 gh-pages 分支从未建过(Matrix 是 baseline fork,bootstrap 阶段),release workflow 没处理这个 edge case。

修复(12 行 bash)

release-branch.yml step「Publish latest.json to gh-pages」:

- git clone --depth=1 --branch=gh-pages "$REPO_URL" "$REPO_DIR"
- cd "$REPO_DIR"
+ if git clone --depth=1 --branch=gh-pages "$REPO_URL" "$REPO_DIR" 2>/dev/null; then
+   echo "gh-pages 已存在 → 在其上 update latest.json"
+   cd "$REPO_DIR"
+ else
+   echo "gh-pages 不存在(首次)→ 初始化为 orphan branch"
+   rm -rf "$REPO_DIR"
+   git clone --depth=1 "$REPO_URL" "$REPO_DIR"
+   cd "$REPO_DIR"
+   git checkout --orphan gh-pages
+   git rm -rf . >/dev/null 2>&1 || true
+ fi

后续 git add latest.json + git commit + git push origin gh-pages 会把 latest.json 作为 orphan 首 commit 推上去,GitHub 自动建 gh-pages 分支。

预期 dogfood

本 PR 合后,下次任一触发(push main / 0 */6 * * * cron / workflow_dispatch):

  1. 早退守门看 https://libz-renlab-ai.github.io/Matrix/latest.json —— 第一次会 404(gh-pages 还没建)→ skip=false,继续
  2. publish 流程跑完到 step 14
  3. clone gh-pages 失败 → 走 orphan 路径
  4. push origin gh-pages → GitHub Pages 自动 enable & serve latest.json
  5. 下次任一触发 → 早退守门成功命中(因为 SHA 已发布)→ skip=true → 后续 12 step 全 skip → workflow 总体 success

至此 docs/WORKFLOW.md 第 8 步「每 6 小时自动发一个 release」真正端到端可用

测试状态

YAML 语法 OK。bash 改动小且独立 —— 没有单元测试,验证靠 dogfood:本 PR 一过 + merge,下一次 release-branch.yml 跑就能验证。

预期 verdict

→ verdict 仍 fail,仍需 human-merge —— 但这是 Gap 2 的锅,不是本 PR 的锅

关联

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented May 15, 2026

Copy link
Copy Markdown

✅ 远程评审 verdict: pass

commit e5004cb · workflow run · 2026-05-15T08:59:38Z

标准 结果 简述
repro-pass 豁免 — all-specs-ci-skip: fixtures/repro-specs/hook-moment-block.ts (需 $TA_DEMO_STAGE 下 home-empty/home-loaded 两份知识库目录预置 + 录 GIF 仅 Win32 可行)
tests-and-merge-clean tests pass + tree clean

issue #5 / PR #2 dogfood 后第 3 个 gap:本仓库从未建过 gh-pages 分支,
release-branch.yml 的 step 14 直接 `git clone --branch=gh-pages` 在
那种情况下报 'fatal: Remote branch gh-pages not found',整个 publish
job 挂在最后一步。

修复(12 行 bash):
  - try clone --branch=gh-pages → 命中走原路径
  - 失败(分支不存在)→ rm 临时目录、clone default、checkout --orphan
    gh-pages、git rm 清 index → 后续 git add + commit + push 会把
    latest.json 作为 orphan 首 commit 推上去,GitHub 自动建 gh-pages

下次 publish run 应:
  - 早退守门看 latest.json(此时 gh-pages 已建好) → 若 SHA 一致 skip
  - 否则正常 publish 更新 latest.json

完整 release pipeline 至此应真端到端可用。验证留给 PR 合后下一次
push main / 6h cron / workflow_dispatch 触发 release-branch.yml。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@libz-renlab-ai
libz-renlab-ai force-pushed the fix/gh-pages-bootstrap branch from 53d35c1 to e5004cb Compare May 15, 2026 08:55
@github-actions
github-actions Bot merged commit c758c5c into main May 15, 2026
7 checks passed
@github-actions

Copy link
Copy Markdown

🤖 远程 review 通过 → 已自动 squash 合并到 main(auto-merge.yml)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

release-branch.yml 在 gh-pages 分支不存在时 bootstrap-fail (issue #3 Gap 3 / 独立)

2 participants