Outline
When you usae GiHub
to manage and deploy the project, you may use the Release note
feature.

However, we can’t use the Release note
in places other than GitHub
. So we also create a CHANGELOG.md
file and manage it separately.
In this blog post, I will introduce how to use changelog-updater Action
of GitHub Actions
to copy automatically the contents from the Release note
of GitHub
to the CHANGELOG.md
file.
Blog series
This blog post is a series. You can see the other posts on the link below.
- [GitHub Actions] Check title of Pull request
- [GitHub Actions] Use Release Drafter to automate Release note of GitHub
- [GitHub Actions] Check label of Pull request
- [GitHub Actions] Automate to update Changelog file
changelog-updater Action
changelog-updater Action
is one of GitHub Actions
to copy the last Release note
of GitHub
to the CHANGELOG.md
file.
To use changelog-updater Action
, create the .github/workflows/update-changelog.yml
file and modify it like the following.
name: Update Changelog
on:
release:
types:
- released
jobs:
update:
name: Update Changelog
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/[email protected]
with:
ref: $
- name: Update Changelog
uses: stefanzweifel/[email protected]
with:
latest-version: $
release-notes: $
- name: Commit updated Changelog
uses: stefanzweifel/[email protected]
with:
branch: $
commit_message: 'docs: Update changelog'
file_pattern: CHANGELOG.md
After creating this GitHub Actions
, when the Release note
is released, the contents of the Release note
is copied to the CHANGELOG.md
file. Of course, the file that is managed by git
will be modified, so it uses the commit_message
for commit
.
CHANGELOG.md file
To update the CHANGELOG.md
file by using changelog-update Action
, CHANGELOG.md
muse exist. Create a CHANGELOG.md
file and modify it like the following.
# Changelog
In order to update the CHANGELOG.md
file using changelog-update Action
, the CHANGELOG.md
file must exist, and one or more heading
must exist.
This blog post uses # Changelog
.
Now, when the Release note
is released
, the CHANGELOG.md
file will be updated like the following.

Release Drafter
If you want to automate the Release note
on GitHub
, you can use Release Drafter
which is one of GitHub Actions
. If you want to know how to use Release Drafte
, please see the following link.
Be careful when using with Release Drafter
. For more details, please see the link below.
In my case, when Git Tag
is added, Release note
is copied to the CHANGELOG.md
file, and then Release note
is released like the following.
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
release:
permissions:
contents: write
pull-requests: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Get semantic version
id: semver
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
- uses: actions/[email protected]
with:
ref: v$
- uses: release-drafter/[email protected]
id: target_release_notes
with:
tag: $
name: $
version: $
env:
GITHUB_TOKEN: $
- name: Update Changelog
uses: stefanzweifel/[email protected]
with:
latest-version: $
release-notes: $
- name: Commit updated Changelog
uses: stefanzweifel/[email protected]
with:
commit_message: 'docs: Update changelog'
file_pattern: CHANGELOG.md
branch: main
- uses: dart-lang/[email protected]
- name: Install dependencies
run: dart pub get
- name: Update version
run: dart run bull pub_version --version=$
- name: Commit updated pubspec
uses: stefanzweifel/[email protected]
with:
commit_message: 'chore: Update version for release'
file_pattern: pubspec.yaml
branch: main
- name: Update Git tag
run: |
git tag $ -f
git push origin $ -f
- uses: release-drafter/[email protected]
with:
tag: $
name: $
version: $
publish: true
env:
GITHUB_TOKEN: $
- name: Publish
run: dart pub publish --force
This code contains GitHub Actions
that deploy the Flutter
package. Therefore, if you do not need this part, you can use the following code by modifying it to suit your situation.
name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
release:
permissions:
contents: write
pull-requests: write
id-token: write
runs-on: ubuntu-latest
steps:
- name: Get semantic version
id: semver
run: echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
- uses: actions/[email protected]
with:
ref: v$
- uses: release-drafter/[email protected]
id: target_release_notes
with:
tag: $
name: $
version: $
env:
GITHUB_TOKEN: $
- name: Update Changelog
uses: stefanzweifel/[email protected]
with:
latest-version: $
release-notes: $
- name: Commit updated Changelog
uses: stefanzweifel/[email protected]
with:
commit_message: 'docs: Update changelog'
file_pattern: CHANGELOG.md
branch: main
...
- name: Commit updated pubspec
uses: stefanzweifel/[email protected]
with:
commit_message: 'chore: Update version for release'
file_pattern: pubspec.yaml
branch: main
- name: Update Git tag
run: |
git tag $ -f
git push origin $ -f
- uses: release-drafter/[email protected]
with:
tag: $
name: $
version: $
publish: true
env:
GITHUB_TOKEN: $
...
If you want to know how to make and deploy the Flutter
package, please see the following link.
Completed
Done! we’ve seen how to use changelog-updater Action
of GitHub Actions
to copy the contents of Release note
in GitHub
to the CHANGELOG.md
file automatically. If you use Release note
of GitHub
and the CHANGELOG.md
file, try to use changelog-updater Action
for automation.
Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!
App promotion
Deku
.Deku
created the applications with Flutter.If you have interested, please try to download them for free.