Description
Enforce Conventional Commits, Add Automatic Changelog Generation, and Implement a CD Workflow
Currently, ruby-git
utilizes the create-github-release
script for new releases. This is documented in the RELEASING.md document. This approach has several drawbacks:
- Determining the appropriate release type (major, minor, or patch) can be challenging without intimate familiarity with every merged pull request (PR).
- After the
create-github-release
script defines a release, incorporating additional PRs into that release is a manual and error-prone process. - The release PR must be merged from a developer's local machine.
- Pushing the new gem to rubygems.org is a manual step.
To address these issues and streamline the release process, I propose integrating the googleapis/release-please-action
. This would enable automated Continuous Delivery releases with the following benefits:
- Automated Release PR Creation: A release PR will be automatically generated when a PR is merged into
master
branch. This PR will update the changelog and version number appropriately, based on the commits since the last release. - Dynamic Release PR Updates: While a release PR is open, any subsequent PRs merged into
master
will be automatically added to the existing release PR. The version bump will be adjusted dynamically based on Conventional Commit messages. - Automated Publishing: When the release PR is merged into
master
, the version will be officially bumped, and a new version of the gem will be built and published to rubygems.org.
For this automation to function correctly, all commits moving forward must adhere to the Conventional Commits format. To enforce this, I propose adding a GitHub Actions workflow that validates commit messages. PRs with improperly formatted commit messages will fail checks, blocking them from being merged.
Additionally, I suggest integrating an optional pre-commit hook. Developers can install this hook locally to automatically check and reject commits that do not conform to the required format before they are pushed.
I have written in more detail about integrating release-please-action
in a Substack article: Continuous Delivery for Ruby Gems.
An example of this integrated system can be seen in the process_executer
gem. Specifically, note the automatically generated CHANGELOG.md and an example release PR.