feat(ci): GitHub Release 发布后自动更新 production 分支触发生产部署 (SHA-4) - #55
Merged
Conversation
新增 release-to-production.yml:GitHub Release 发布后把 production 分支指针 快进到该 release 的 commit(strict fast-forward,绝不 force),Vercel Branch Tracking 随之触发生产构建与部署;workflow_dispatch 支持补发/重跑。回滚为 维护者手动 force-with-lease。CONTRIBUTING.md Release 闸门同步 production 分支机制与回滚命令。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…oy to dedicated SSH key - production 分支启用 ruleset 保护:require_pull_request(1 审查) + 禁止 force push + 禁止删除 - 工作流改用专用 deploy key(secret PRODUCTION_DEPLOY_KEY) 通过 SSH 更新指针 - GITHUB_TOKEN 降为只读(contents: read),无法再触碰 production - 固定 github.com 官方 RSA host key 指纹(校验 ssh-keyscan 结果,防 TOFU 中间人) - CONTRIBUTING.md 更新分支保护现状说明
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更说明
实现「GitHub Release 发布 → 更新
production分支 → 触发 Vercel 生产部署」的发布流程(SHA-4 拆分任务 SHA-11),并对production分支启用真实的分支保护:.github/workflows/release-to-production.yml(Deploy release to production):GitHub Release 发布(release: published)后,将production分支指针快进到该 release 的 tag commit;Vercel 的 Branch Tracking(已填production)随之触发生产构建与部署。支持workflow_dispatch手动指定 tag 补发/重跑。production已启用两个仓库 ruleset:production: guarded updates:require_pull_request(1 个审查),bypass 仅限专用 deploy key 与 admin;production: no force push or deletion:禁止 force push、禁止删除分支,bypass 仅限 admin(供回滚用--force-with-lease)。工作流不再用
GITHUB_TOKEN推指针,改用专用 deploy key(secretPRODUCTION_DEPLOY_KEY,SSH,仅本仓库写权限)经 SSH 推送;GITHUB_TOKEN降为只读。GITHUB_TOKEN/普通协作者推送将被 ruleset 拒绝。CONTRIBUTING.md「Release 闸门」同步production分支机制、回滚命令与分支保护现状;发布步骤按新流程调整为线性顺序。只更新分支指针、不创建新提交、不并入
main开发内容;本 PR 不 pushproduction分支、不执行部署、不改生产数据。变更类型
方案取舍
release: published自动触发(主路径)+workflow_dispatch手动补发/重跑(兜底)。手动单独触发会增加操作摩擦且容易漏发production指针的后代,否则失败并明确报错;绝不 forceproduction永远可回滚、可追溯production启用 ruleset:require_pull_request(1 审查) + 禁止 force push + 禁止删除;工作流改用专用 deploy key(PRODUCTION_DEPLOY_KEY)作为 bypass actor 推送,GITHUB_TOKEN降为只读git push --force-with-lease origin <上一个vX.Y.Z>^{commit}:production,再跑Release production verification复核release.yml负责 tag 产物验证(Release 创建前必须全绿),release-production.yml负责部署后站点验收;新增工作流只负责中间一环「更新 production 指针」,不重复验证依赖关系:创建 GitHub Release 即代表该 tag 已通过
Release verification(CONTRIBUTING.md「Release 闸门」第 2、3 条),因此本工作流不重复验证产物。检查清单
npm run check通过npm run public:check通过actionlint对本工作流及现有release.yml/release-production.yml/ci.yml均无告警Bypassed rule violations)、admin 令牌推送被拒(GH013).env、.vercel、secret key 或个人数据CONTRIBUTING.md;README/CHANGELOG/RELEASE_NOTES 不涉及本次内部工作流改动,无需更新npm run public:check,并复查暂存区没有内部、敏感或不必要文件验证记录
npm run check:Static checks passed.npm run public:check:Public repository check passed (0 staged paths, 178 candidate paths).actionlint 1.7.7:新增与现有工作流均无输出(无问题)production快进到目标 tag commit ✅4. deploy key(SSH)推送:
remote: Bypassed rule violations ... Changes must be made through a pull request,推送成功 ✅5. admin 令牌(HTTPS,不在 bypass 集合):
remote: GH013 ... push declined due to repository rule violations,被拒 ✅ssh-keyscan指纹校验(固定 GitHub 官方 RSA host keySHA256:uNiVzt...)、ssh config 生成均通过 ✅npm run test:full等(不涉及源码/数据库/浏览器行为,按风险矩阵不适用)