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@v2
- 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@v2
- 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@v2
- name: Extract release notes
uses: ffurrer2/extract-release-notes@v1
with:
release_notes_file: RELEASE_NOTES.md
The scripts and documentation in this project are released under the MIT License.