From 381e7abd467adcf4fc07b441c39feaef9cf3c1ec Mon Sep 17 00:00:00 2001 From: yunyingk Date: Mon, 28 Sep 2026 11:58:29 +0800 Subject: [PATCH] Remove legacy git push home from release scripts and docs --- AGENTS.md | 22 +++++++++------------- README.md | 21 +++++++++------------ scripts/bump-version.ts | 4 ++-- scripts/release.ts | 22 +++------------------- 4 files changed, 23 insertions(+), 46 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 86978be..7833886 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -66,14 +66,14 @@ Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`, 1. **Automated Release Command (Preferred)**: - Run `bun run release ` (supports `--dry-run`). - - This script automatically encapsulates the full 14-step protected-branch release lifecycle: + - This script automatically encapsulates the protected-branch release lifecycle: 1. Pre-flight cleanliness & `gh` authentication checks. 2. Manifest version bumping (`bump-version.ts`) & automatic `CHANGELOG.md` entry generation. 3. Local validation (`bun test && bun run check`). - 4. Release branch creation (`codex/release-vX.Y.Z`), commit, and push. - 5. GitHub PR creation, CI monitoring, and squash/merge. - 6. Main branch fast-forward & Gitea (`home/main`) mirror synchronization. - 7. Annotated tag creation (`vX.Y.Z`) and dual-remote push (`home` then `origin`). + 4. Release branch creation (`codex/release-vX.Y.Z`), commit, and push to `origin`. + 5. GitHub PR creation, CI monitoring, and merge. + 6. Main branch fast-forward (`git pull --ff-only origin main`). + 7. Annotated tag creation (`vX.Y.Z`) and push to `origin` (`git push origin refs/tags/vX.Y.Z`). 8. Clean removal of temporary release branch. 2. **Manual Protected-Branch Release & Workspace Isolation (Reference)**: @@ -86,7 +86,7 @@ Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`, git worktree remove /tmp/seal-use-release ``` - Do not tag or push `main` directly. Create a release branch, commit the version bump, push it, open a PR to `main`, wait for the required CI check, and merge the PR first. - - After the PR is merged, fast-forward the local `main`, then synchronize `home/main` before creating the tag: + - After the PR is merged, fast-forward the local `main`, then create and push the annotated tag to `origin`: ```bash git switch -c codex/release-vX.Y.Z git add @@ -97,16 +97,12 @@ Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`, gh pr merge --merge git switch main git pull --ff-only origin main - git push home main - ``` - - Only after both `origin/main` and `home/main` contain the merged release should you create the annotated tag. Push the tag to `home` first, then to `origin`; pushing the GitHub tag last triggers the Release workflow after the Gitea tag and branch are ready: - ```bash git tag -a vX.Y.Z -m "🚀 Release summary text describing key changes" - git push home refs/tags/vX.Y.Z git push origin refs/tags/vX.Y.Z ``` - - GitHub Actions will automatically extract the tag message, append commit notes via `--generate-notes`, cross-compile all 5 target binaries, and publish GitHub and Gitea releases. Wait for the workflow, then verify that both releases point to the intended tag commit and contain every expected asset exactly once. - - The workflow enforces the merge-before-tag rule rather than trusting the operator: `release.yml` refuses to publish unless the tagged commit is an ancestor of `origin/main`, and the Gitea mirror job runs only after a successful publish. Actions in both workflows are pinned to commit SHAs rather than moving tags for supply-chain integrity. + - GitHub Actions (`release.yml`) is responsible only for cross-compiling all 5 target binaries and publishing the GitHub Release. + - **Gitea & Homebrew Pull-Based Promotion**: Do not manually push branches or tags to `home` (Gitea). On WSL (`wsl-dev`), `seal-use-release-sync.timer` polls the latest GitHub Release every 15 minutes (or can be triggered immediately via `systemctl start seal-use-release-sync.service`), pulls the release and assets from GitHub into Gitea, and updates the Homebrew tap (`ops/README.md`). + - The workflow enforces the merge-before-tag rule rather than trusting the operator: `release.yml` refuses to publish unless the tagged commit is an ancestor of `origin/main`. Actions in both workflows are pinned to commit SHAs rather than moving tags for supply-chain integrity. ## Security & Configuration Tips diff --git a/README.md b/README.md index b81e892..c420498 100644 --- a/README.md +++ b/README.md @@ -347,22 +347,19 @@ bun run bump 0.8.5 5. Rebuilds OpenAPI spec (`dist/openapi.json`) and MCP plugin bundle (`dist/mcp/server.js`); 6. Prints the exact `git commit` and `git tag` commands ready to execute. -### 2. Tag & Dual-Publish Workflow +### 2. Tag & Publish Workflow -1. Update `CHANGELOG.md` with the new version notes; -2. Run test suite: +1. Run the automated protected-branch release wizard: ```bash - bun test && bun run check + bun run release patch ``` -3. Commit and push the annotated tag: + Or manually merge the release PR to `main`, fast-forward local `main`, and push the annotated tag to `origin`: ```bash - git commit -am "Release vX.Y.Z: ..." git tag -a vX.Y.Z -m "🚀 版本更新文案与主要特性说明" - git push origin main --tags && git push home main --tags + git push origin refs/tags/vX.Y.Z ``` -**CI Automation Pipeline:** -- GitHub Actions triggers automatically upon pushing a `v*` tag; -- Cross-compiles standalone binaries for 5 target platforms (macOS Apple Silicon/Intel, Linux x86_64/ARM64, Windows x64) in under 60 seconds; -- Automatically extracts your Git tag annotation message and appends commit changelogs (`--generate-notes`); -- Simultaneously publishes release packages to **[GitHub Releases](https://github.com/yunyingk/seal-use/releases)** and **[Gitea Releases](https://git.ying-qing.cn/gitea/seal-use/releases)** for global and mainland China high-speed downloads. +**CI & Promotion Pipeline:** +- GitHub Actions triggers automatically upon pushing a `v*` tag to `origin`; +- Cross-compiles standalone binaries for 5 target platforms (macOS Apple Silicon/Intel, Linux x86_64/ARM64, Windows x64) and publishes them to **[GitHub Releases](https://github.com/yunyingk/seal-use/releases)**; +- WSL `seal-use-release-sync.timer` polls the latest GitHub Release and promotes all assets to **[Gitea Releases](https://git.ying-qing.cn/gitea/seal-use/releases)** and the Homebrew tap (`ops/README.md`). diff --git a/scripts/bump-version.ts b/scripts/bump-version.ts index 70ea6f5..3dda41e 100644 --- a/scripts/bump-version.ts +++ b/scripts/bump-version.ts @@ -117,6 +117,6 @@ console.log(` 2. git commit -am "Release v${nextVersion}: "`); console.log(` 3. git push origin HEAD:refs/heads/codex/release-v${nextVersion}`); console.log(` 4. gh pr create --base main --head codex/release-v${nextVersion} --title "Release v${nextVersion}: ..."`); console.log(` 5. gh pr checks --watch && gh pr merge --merge`); -console.log(` 6. git switch main && git pull --ff-only origin main && git push home main`); +console.log(` 6. git switch main && git pull --ff-only origin main`); console.log(` 7. git tag -a v${nextVersion} -m "🚀 "`); -console.log(` 8. git push home refs/tags/v${nextVersion} && git push origin refs/tags/v${nextVersion}\n`); +console.log(` 8. git push origin refs/tags/v${nextVersion}\n`); diff --git a/scripts/release.ts b/scripts/release.ts index 69f03dc..dec7406 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -87,10 +87,6 @@ if (!remotes.includes("origin")) { console.error("❌ 未找到 'origin' 远程仓库。"); process.exit(1); } -const hasHomeRemote = remotes.includes("home"); -if (!hasHomeRemote) { - console.warn("⚠️ 未找到 'home' 镜像远程仓库,将仅向 'origin' 推送。"); -} // Check GitHub CLI try { @@ -113,7 +109,7 @@ if (isDryRun) { console.log(` 4. git commit -m "Release ${tag}: ..."`); console.log(` 5. git push origin HEAD:refs/heads/${releaseBranch}`); console.log(` 6. gh pr create && gh pr checks --watch && gh pr merge --merge`); - console.log(` 7. 同步 main,打标 ${tag} 并推送到 origin 与 home`); + console.log(` 7. 同步 main,打标 ${tag} 并推送到 origin(Gitea 与 Homebrew 由 WSL seal-use-release-sync 主动拉取)`); process.exit(0); } @@ -173,24 +169,14 @@ try { console.log(`🚀 自动合并 PR #${prNumber} 到 main...`); run(`gh pr merge ${prNumber} --merge`); - // 8. Pull main, sync home, and tag + // 8. Pull main and push tag to origin console.log("\n🏷️ 步骤 7/8: 同步主干分支并创建官方签名 Tag..."); run("git switch main"); run("git pull --ff-only origin main"); - if (hasHomeRemote) { - console.log("🔄 同步推送 main 到 home (Gitea)..."); - run("git push home main"); - } - const tagMessage = `🚀 Release ${tag}: Automated release`; run(`git tag -a ${tag} -m "${tagMessage}"`); - if (hasHomeRemote) { - console.log(`📤 推送 Tag ${tag} 到 home (Gitea)...`); - run(`git push home refs/tags/${tag}`); - } - console.log(`📤 推送 Tag ${tag} 到 origin (GitHub,触发 Release 构建)...`); run(`git push origin refs/tags/${tag}`); @@ -220,8 +206,6 @@ if (success) { console.log(`🎉 恭喜!Seal Use ${tag} 已成功发布并触发多平台自动化编译!`); console.log(" • GitHub Actions 构建中心: https://github.com/yunyingk/seal-use/actions"); console.log(` • GitHub Release 页面: https://github.com/yunyingk/seal-use/releases/tag/${tag}`); - if (hasHomeRemote) { - console.log(` • Gitea Release 镜像: https://git.ying-qing.cn/gitea/seal-use/releases/tag/${tag}`); - } + console.log(" • Gitea 与 Homebrew Tap 将由 WSL seal-use-release-sync.timer 自动拉取晋升"); console.log("========================================================\n"); }