GitHub 发布 PR 与版本自动化
release-please 根据 Conventional Commits 维护发布 PR,合并后自动打 tag 和生成 GitHub Release。它用 manifest 文件跟踪每个包的版本。
npx release-please release-pr \
--token="$GITHUB_TOKEN" \
--repo-url=example/app \
--target-branch=main
npx release-please github-release \
--token="$GITHUB_TOKEN" \
--repo-url=example/app \
--target-branch=main
npx release-please manifest
GitHub Action:
- uses: googleapis/release-please-action@v4
with:
release-type: node
token: ${{ secrets.GITHUB_TOKEN }}
release-please-config.json:
{
"release-type": "node",
"packages": {
".": {
"changelog-path": "CHANGELOG.md"
}
}
}
GITHUB_TOKEN 权限不足时无法创建 PR 或 Release;需要 contents 和 pull-requests 写权限。semantic-release — 另一套自动发布方案github-actions — 运行 Actioncommitlint — 提交信息规范