release-please 自动版本管理
Conventional Commits 驱动的自动版本管理:commit 类型决定版本 bump、自动生成 CHANGELOG 和 Release PR。
#type / howto
#status / growing
#tech / ops
#resource / github-actions
[!info] related notes
- 前置: Conventional Commits
- 触发: Watchtower 自动部署
release-please 自动版本管理
完整流程
commit (feat/fix) → 合并到 main
→ release-please 创建 Release PR(版本 bump + CHANGELOG)
→ 维护者合并 Release PR
→ 创建 GitHub Release + tag
→ tag push 触发 Docker 构建
→ Watchtower 自动部署
Commit 类型与版本
| 类型 | 版本 bump | 示例 |
|---|---|---|
feat: | minor (0.1→0.2) | feat: add training plan |
fix: | patch (0.2→0.2.1) | fix: login redirect |
feat!: | major (0.2→1.0) | feat!: new API format |
docs:, chore: | 不 bump | docs: update README |
配置
{
"include-v-in-tag": true,
"packages": {
".": { "release-type": "node" }
}
}
为什么需要 PAT
release-please 需要 PAT 而不是默认 GITHUB_TOKEN,因为 GITHUB_TOKEN 创建的事件不会触发其他 workflow。