Curious about what is being released into a project?
Keep a Changelog, it keeps your audience up to date with the latest changes at a glance!
And even better, automate the CHANGELOG.md each time a PR is merged into the base branch:
- by using conventional commits, it creates a standard type for having a commit message format:
type(optional scope): message
- and adding release please to your repository as a github action
How to automate the Changelog
1 - Create .github/workflows/release-please.yml
at the root of the repository
$ mkdir .github && cd .github && mkdir workflows && cd workflows && touch release-please.yml
2 - Modify the changes on release-please.yml
and choose the release-type
# release-please.yml
on:
push:
branches:
- main
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: simple
3 - Add the commit message and merge the branch. Make sure to follow conventional commits.
4 - Some changelog sections will not be displayed. To override the default, update the release-please.yml with changelog-types
with the field hidden:false
# release-please.yml
...
with:
release-type: simple
changelog-types: >
[
{ "type": "build", "section": "Build System", "hidden": false },
{ "type": "ci", "section": "Continuous Integration", "hidden": false },
{ "type": "chore", "section": "Miscellaneous Chores", "hidden": false },
{ "type": "docs", "section": "Documentation", "hidden": false },
{ "type": "feat", "section": "Features", "hidden": false },
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
{ "type": "perf", "section": "Performance Improvements", "hidden": false },
{ "type": "revert", "section": "Reverts", "hidden": false },
{ "type": "refactor", "section": "Code Refactoring", "hidden": false },
{ "type": "style", "section": "Styles", "hidden": false },
{ "type": "test", "section": "Tests", "hidden": false }
]
5 - Configure default to PR title for squash and merge commits when merging a pull request
6 - See the automated changelog PR - github link
Using the Squash and merge
PR in github will group the commits into one commit, displaying just one line with the PR#
. While not using the Squash and merge
PR, each commit will be listed on its own, as displayed under the section "Continuous Integration"
The individual commit history of the PR can still be viewed by clicking the PR# in the CHANGELOG.MD
Release notes can also be overridden in the body of the PR with the changelog reflecting the changes
Simplify merged PRs
Configure merged PRs to keep a cleaner history in the base branch
1 - Add a branch protection rule to require branches to be up to date before merging
2 - Use squash and merge commits on PRs to keep a cleaner commit history in the base branch
3 - Delete branches automatically after a merge
The Github repo for this tutorial can be found here
Top comments (0)