GitHub Action
Release with Changelog
Just use the gh release create
command, for example:
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create "$GITHUB_REF_NAME" # GITHUB_REF_NAME is the tag name in `on.push.tags` workflows
You can also attach files to the releases, for example see this PR.
Creates reasonable enough GitHub releases for pushed tags, with the commit log as release body.
The action also has customizable release body, that support markdown, and template fields. See template option to see how that works.
By no means is this an action with extensive configurable options except for the ones already provided. But I would love to add some more in the future.
jobs:
Release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 50
- uses: fregante/release-with-changelog@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
Or you can customize it further:
- uses: fregante/release-with-changelog@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
exclude: '^Meta'
commit-template: '- {title} ← {hash}'
template: |
### Changelog
{commits}
{range}
❤
The action expects you to do a deep clone of the repository using actions/checkout@v2
in order to get historical commits. You can use fetch-depth: 0
for actions/checkout
action to clone entire repository or have a reasonable number like 100
to fetch the last 100 commits.
Required: Personal access token used to create releases.
Default: {tag}
Title for the release being create. Available replacements:
{tag}
The tag for which the changelog is being generated.
Default:
{commits}
{range}
Markdown template to be included in release notes. Available replacements:
{commits}
List of commits for this release, seecommit-template
below for format of each entry.{range}
A link to diff on GitHub between the last and current release.
Default: '- {hash} {title}'
Markdown template for each commit entry in release notes. Available replacements:
{title}
A single line title of the commit.{hash}
Abbreviated commit hash, gets linkified automatically in release notes.{url}
Plain link to commit on GitHub.{date}
Date of commit, could be specified indate-format
.
Default: ''
Example: '^Meta:'
Example: true
Regex to exclude commits based on their title (don't include the initial and final /
).
Setting this to true
will enable the default preset, which may change over time, but is currently: /^meta|^document|^lint|^refactor|readme|dependencies|^v?\d+\.\d+\.\d+/i
Default: the tag that triggered the workflow run or the latest tag available
Specific tag for which to generate changelog.
Default: short
Example: local
Example: %d.%m.%Y
Format of {date}
replacement as used by git log --date
, as either a keyword or a strftime
string. More info can be found in StackOverflow answer.
Default: desc
Example: asc
Set to asc
if you want to have changelog printed in reverse order.
Default: false
Example: true
Set to true
if you want to have draft release.
Default: false
Example: true
Set to true
if you want to have prerelease instead release.
Default: false
Example: true
Set to true
if you want to skip creating the release when all commits are excluded.
Will be set to true
if skip-on-empty is enabled and a release was not created, false
otherwise.
The release ID
The URL users can navigate to in order to view the release. i.e. https://github.com/octocat/Hello-World/releases/v1.0.0
The URL for uploading assets to the release, which could be used by GitHub Actions for additional uses, for example the @actions/upload-release-asset
GitHub Action
If you already have tags/releases without release notes, delete the empty releases (not the tags) and use vercel/release to create the release notes for those tags:
# Unsaved changes might be lost. Push your changes to GitHub before running this
npm install release -g
for tag in $(git tag); do
git checkout $tag && release;
done
git checkout origin/master