Hands-on Demo – Automating release notes with GitHub
Automating release notes generation helps streamline the process of documenting changes for each release. GitHub provides features to automatically generate release notes, which can be customized using templates.
1. Creating Automatically Generated Release Notes
GitHub allows you to automatically generate release notes based on commit messages, pull requests, and issues. Here’s how you can set it up:
Steps to Automatically Generate Release Notes:
Navigate to your repository on GitHub.
Click the Releases tab.
Click Draft a new release.
Under the Release notes section, you will see options for automatically generating release notes based on:
Commit messages
Pull requests
Issues
GitHub will generate a summary of changes based on the selected option.
2. Configuring Automatically Generated Release Notes Template
You can customize how the release notes are generated by configuring a template for release notes.
Steps to Configure Release Notes Template:
Navigate to Settings in your repository.
Click on Actions > Workflow Templates.
Create a new workflow or edit an existing one that includes steps for generating release notes.
Example workflow using a template:
xxxxxxxxxx211nameCreate Release Notes2on3push4branches5main6jobs7generate-release-notes8runs-onubuntu-latest9steps10nameCheckout Repository11usesactions/checkout@v312nameGenerate Release Notes13usesactions/github-script@v314with15script16const { context } = require('@actions/github');17const { context: { payload } } = context;18const changelog = context.payload.commits.map(commit => commit.message).join('\\n');19console.log(changelog);20outputs21release-notes$ steps.changelog.outputs.release-notesCustomize the release notes format by editing the GitHub Actions workflow to include specific sections, like features, bug fixes, or breaking changes.
3. Adding Custom Templates for Release Notes
You can further enhance the release notes by defining a custom template.
For example, including sections like:
Features
Fixes
Enhancements
Known Issues
Example Custom Template:
xxxxxxxxxx91# Release Notes for v{{ github.ref_name }}2## Features3{{#features}}4- {{title}}: {{description}}5{{/features}}6## Bug Fixes7{{#bugs}}8- {{title}}: {{description}}9{{/bugs}}Customize and map the JSON output to desired sections using actions/github-script or similar workflows.
4. Benefits of Automating Release Notes
Consistency: Automatically generated notes ensure a consistent format across releases.
Efficiency: Saves time by eliminating manual creation of release notes.
Customization: Provides flexibility to customize release notes templates according to your project needs.
Summary
By automating release notes, teams can ensure that updates are documented accurately and efficiently, reducing manual effort and improving collaboration.






















Leave a Reply