Automatically Generate Release Notes Using GitHub Actions When Tag Is Pushed
Introduction
I’ve recently been developing a Chrome extension for tab management called TabTabTab as a personal project. Whenever I released a new version, I would push a tag to GitHub and create a release note manually.
I decided to automate this process because it was getting tedious. So, I turned to GitHub Actions.
Process Flow
The overall process is as follows:
- Push a tag to GitHub.
- The push of a tag triggers a GitHub Actions workflow.
- Within the workflow, a release note is generated.
Workflow Configuration File
I set up the following yaml file as .github/workflows/generate-release-note.yml
.
name: Generate Release Note
on:
push:
tags:
- '*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate release note
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
Here is the part that triggers the workflow on tag push:
on:
push:
tags:
- '*'
For creating a release, I used an action called softprops/action-gh-release.
- name: Generate release note
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
You can set tag names, release names, etc., but I did not need to specify any because the defaults were sufficient for my needs. However, to generate release notes, I set generate_release_notes
to true
.
For other settings, please refer to the README.
Generated Release Note
Here is the release note generated by the above configuration. It’s created by github-actions
.
By the way, the structure of the release note, such as 🎉 Features
, is controlled by .github/release.yml
.
For more about this, check out the following article if you’re interested:
👉 Categorize GitHub Repository Release Notes by Content for a Nice Look
Conclusion
Now, just by pushing a tag, a release note is automatically generated, eliminating one more hassle during release.
GitHub Actions is incredibly useful for easily solving such mundane tasks.