You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
Extract Release Notes
v1.16.0
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:
build:
name: Create release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
body: ${{ steps.extract-release-notes.outputs.release_notes }}
This 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 official create-release action.
This uses the GITHUB_TOKEN
provided by the virtual environment, so no new token is needed.
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
with:
changelog_file: MY_CHANGELOG.md
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Extract release notes
uses: ffurrer2/extract-release-notes@v1
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:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Extract release notes
uses: ffurrer2/extract-release-notes@v1
with:
prerelease: true
The scripts and documentation in this project are released under the MIT License.