patternbashTip
release-please for automated changelog and release PR generation
Viewed 0 times
googleapis/release-please-action@v4
release-pleasechangelogconventional commitssemantic versioningnpm publishmonorepo release
Problem
Manually maintaining CHANGELOGs and bumping version numbers is error-prone and forgotten under pressure. Releases go out without a changelog, or with incorrect version numbers that violate semantic versioning.
Solution
Configure release-please to automate releases from conventional commits:
release-please.json for monorepo:
# .github/workflows/release.yml
on:
push:
branches: [main]
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}
- name: Publish to npm
if: ${{ steps.release.outputs.release_created }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}release-please.json for monorepo:
{
"packages": {
"packages/api": { "release-type": "node" },
"packages/web": { "release-type": "node" }
}
}Why
release-please reads conventional commit messages (feat:, fix:, feat!:) to determine version bumps and generates the CHANGELOG automatically. The release PR is opened automatically and merged when you are ready to release.
Gotchas
- Commits must follow conventional commits spec exactly—typos like 'Feat:' (capital F) are ignored
- release-please opens one PR at a time and updates it as new commits land—merging that PR triggers the release
- The GITHUB_TOKEN needs write permissions to contents and pull-requests
Revisions (0)
No revisions yet.