version-release by lobehub/lobehub
npx skills add https://github.com/lobehub/lobehub --skill version-release主要开发分支是 canary。所有日常开发都在 canary 分支上进行。发布时,canary 分支会被合并到 main 分支。合并后,auto-tag-release.yml 会自动处理打标签、版本号递增、创建 GitHub Release 以及同步回 canary 分支。
实际中只使用两种发布类型(主版本发布极其罕见,可以忽略):
| 类型 | 使用场景 | 频率 | 源分支 | PR 标题格式 | 版本号 |
|---|---|---|---|---|---|
| 次要版本 | 功能迭代发布 | 约每 4 周 | canary | 🚀 release: v{x.y.0} | 手动设置 |
| 补丁版本 | 每周发布 / 热修复 / 模型 / 数据库迁移 | 约每周或按需 | canary 或 main | 自定义(例如 🚀 release: 20260222) |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 自动补丁号 +1 |
用于发布新的次要版本(例如 v2.2.0),大约每 4 周一次。
git checkout canary
git pull origin canary
git checkout -b release/v{version}
git push -u origin release/v{version}
2. 确定版本号 — 从 package.json 读取当前版本,并计算下一个次要版本(例如 2.1.x → 2.2.0)
gh pr create \
--title "🚀 release: v{version}" \
--base main \
--head release/v{version} \
--body "## 📦 Release v{version} ..."
[!IMPORTANT]: PR 标题必须严格匹配
🚀 release: v{x.y.z}格式。CI 使用正则表达式解析此标题以确定确切的版本号。
bun run release:branch # 交互式
bun run release:branch --minor # 直接指定次要版本
版本号通过补丁号自动递增 +1。有 4 种常见场景:
| 场景 | 源分支 | 分支命名 | 描述 |
|---|---|---|---|
| 每周发布 | canary | release/weekly-{YYYYMMDD} | 每周发布列车,canary → main |
| Bug 热修复 | main | hotfix/v{version}-{hash} | 紧急 Bug 修复 |
| 新模型上线 | canary | 社区 PR 直接合并 | 新模型上线,由 PR 标题前缀触发 |
| 数据库模式迁移 | main | release/db-migration-{name} | 数据库迁移,需要专门的变更日志 |
所有场景都会自动递增补丁号 +1。补丁 PR 标题不需要包含版本号。各场景的详细步骤请参阅 reference/patch-release-scenarios.md。
bun run hotfix:branch # 热修复场景
PR 合并到 main 分支后,CI 根据以下优先级决定是否发布:
PR 标题匹配 🚀 release: v{x.y.z} → 使用标题中的版本号。
由以下优先级触发:
hotfix/* 或 release/* → 直接触发(跳过标题检测)style / 💄 stylefeat / ✨ featfix / 🐛 fixrefactor / ♻️ refactorhotfix / 🐛 hotfix / 🩹 hotfixbuild / 👷 build不匹配上述任何条件的 PR(例如 docs、chore、ci、test 前缀)在合并到 main 分支时不会触发发布。
🔖 chore(release): release version v{x.y.z} [skip ci]v{x.y.z}当用户请求发布时:
package.json 获取当前版本并计算下一个次要版本release/v{version} 分支🚀 release: v{version}在创建发布分支之前,验证源分支:
release/weekly-*): 必须从 canary 分支创建main 分支创建 — 运行 git merge-base --is-ancestor main <branch> && echo OK 来确认根据场景选择合适的工作流(参见 reference/patch-release-scenarios.md):
release/weekly-{YYYYMMDD} 分支,扫描 git log main..canary 来编写变更日志,标题类似 🚀 release: 20260222hotfix/ 分支,使用 gitmoji 前缀标题(例如 🐛 fix: ...)feat / style)自动触发,无需额外步骤release/db-migration-{name} 分支,挑选迁移提交,编写专门的迁移变更日志所有发布 PR 正文(包括次要版本和补丁版本)必须包含面向用户的变更日志。通过 git log main..canary --oneline 或 git diff main...canary --stat 扫描变更,然后按照以下格式编写。
reference/changelog-example/weekly-release.mdreference/changelog-example/db-migration.md**粗体**git log 收集所有提交者并按字母顺序列出每周安装量
203
仓库
GitHub Stars
74.3K
首次出现
2026年2月21日
安全审计
安装于
github-copilot201
codex201
kimi-cli200
amp200
opencode200
cursor200
The primary development branch is canary. All day-to-day development happens on canary. When releasing, canary is merged into main. After merge, auto-tag-release.yml automatically handles tagging, version bumping, creating a GitHub Release, and syncing back to the canary branch.
Only two release types are used in practice (major releases are extremely rare and can be ignored):
| Type | Use Case | Frequency | Source Branch | PR Title Format | Version |
|---|---|---|---|---|---|
| Minor | Feature iteration release | ~Every 4 weeks | canary | 🚀 release: v{x.y.0} | Manually set |
| Patch | Weekly release / hotfix / model / DB migration | ~Weekly or as needed | canary or main | Custom (e.g. 🚀 release: 20260222) | Auto patch +1 |
Used to publish a new minor version (e.g. v2.2.0), roughly every 4 weeks.
git checkout canary
git pull origin canary
git checkout -b release/v{version}
git push -u origin release/v{version}
2. Determine the version number — Read the current version from package.json and compute the next minor version (e.g. 2.1.x → 2.2.0)
gh pr create \
--title "🚀 release: v{version}" \
--base main \
--head release/v{version} \
--body "## 📦 Release v{version} ..."
[!IMPORTANT]: The PR title must strictly match the
🚀 release: v{x.y.z}format. CI uses a regex on this title to determine the exact version number.
bun run release:branch # Interactive
bun run release:branch --minor # Directly specify minor
Version number is automatically bumped by patch +1. There are 4 common scenarios:
| Scenario | Source Branch | Branch Naming | Description |
|---|---|---|---|
| Weekly Release | canary | release/weekly-{YYYYMMDD} | Weekly release train, canary → main |
| Bug Hotfix | main | hotfix/v{version}-{hash} | Emergency bug fix |
| New Model Launch | canary | Community PR merged directly | New model launch, triggered by PR title prefix |
| DB Schema Migration | main | release/db-migration-{name} | Database migration, requires dedicated changelog |
All scenarios auto-bump patch +1. Patch PR titles do not need a version number. See reference/patch-release-scenarios.md for detailed steps per scenario.
bun run hotfix:branch # Hotfix scenario
After a PR is merged into main, CI determines whether to release based on the following priority:
PR title matches 🚀 release: v{x.y.z} → uses the version number from the title.
Triggered by the following priority:
hotfix/* or release/* → triggers directly (skips title detection)style / 💄 stylefeat / ✨ featfix / 🐛 fixrefactor / ♻️ refactorPRs that don't match any of the above conditions (e.g. docs, chore, ci, test prefixes) will not trigger a release when merged into main.
🔖 chore(release): release version v{x.y.z} [skip ci]v{x.y.z}When the user requests a release:
package.json to get the current version and compute the next minor versionrelease/v{version} branch from canary🚀 release: v{version}Before creating the release branch, verify the source branch:
release/weekly-*): must branch from canarymain — run git merge-base --is-ancestor main <branch> && echo OK to confirmChoose the appropriate workflow based on the scenario (see reference/patch-release-scenarios.md):
release/weekly-{YYYYMMDD} branch from canary, scan git log main..canary to write the changelog, title like 🚀 release: 20260222hotfix/ branch from main, use a gitmoji prefix title (e.g. 🐛 fix: ...)feat / style), no extra steps neededrelease/db-migration-{name} branch from main, cherry-pick migration commits, write a dedicated migration changelogAll release PR bodies (both Minor and Patch) must include a user-facing changelog. Scan changes via git log main..canary --oneline or git diff main...canary --stat, then write following the format below.
reference/changelog-example/weekly-release.mdreference/changelog-example/db-migration.md**bold** for important feature namesgit log and list alphabeticallyWeekly Installs
203
Repository
GitHub Stars
74.3K
First Seen
Feb 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
github-copilot201
codex201
kimi-cli200
amp200
opencode200
cursor200
hotfix / 🐛 hotfix / 🩹 hotfixbuild / 👷 build