GitHub Action
Extract Release Notes
v2.2.0
Latest version
This GitHub Action extracts release notes from a Keep a Changelog formatted changelog file.
- Create a
CHANGELOG.md
file based on the changelog format of the Keep a Changelog project. - Create a workflow
.yml
file in your.github/workflows
directory. An example workflow is available below. For more information, reference the GitHub Help Documentation for Creating a workflow file.
Input | Description |
---|---|
changelog_file (optional) |
The input path of the changelog file. Default: CHANGELOG.md |
release_notes_file (optional) |
The output path of the (optional) release notes file. |
Output | Description |
---|---|
release_notes |
The escaped release notes. |
On every push
to a tag matching the pattern *.*.*
, extract the release notes from the CHANGELOG.md
file and create a release:
name: Create Release
on:
push:
tags:
- '*.*.*'
jobs:
release:
name: Create release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create ${{ github.ref_name }} --notes '${{ steps.extract-release-notes.outputs.release_notes }}'
This code will extract the content between the second and third H2 header from the CHANGELOG.md
file, store this content in the output variable release_notes
and create a release using the gh release create
command.
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2
with:
changelog_file: MY_CHANGELOG.md
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract release notes
uses: ffurrer2/extract-release-notes@v2
with:
release_notes_file: RELEASE_NOTES.md
To extract the content between the first (## [Unreleased]
) and second H2 header, set the prerelease
parameter to true
.
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract release notes
uses: ffurrer2/extract-release-notes@v2
with:
prerelease: true
This project is licensed under the MIT License.