개요
GitHub
에서 프로젝트를 관리하고 배포하는 경우, Release note
기능을 활용하게 됩니다.

하지만, GitHub
가 아닌 곳에서는 이 Release note
를 활용할 수 없으므로, CHANGELOG.md
파일을 만들고 따로 관리하기도 합니다.
이번 블로그 포스트에서는 GitHub Actions
의 changelog-updater Action
를 사용하여 GitHub
의 Release note
에 작성된 내용을 자동으로 CHANGELOG.md
파일로 복사하는 방법에 대해서 알아보도록 하겠습니다.
블로그 시리즈
이 블로그는 시리즈로 제작되었습니다. 다음 링크를 통해 다른 블로그 포스트도 확인해 보시기 바랍니다.
- [GitHub Actions] Pull request 제목 검사
- [GitHub Actions] Release Drafter를 사용하여 GitHub의 Release note 자동화 하기
- [GitHub Actions] Pull request 라벨 검사하기
- [GitHub Actions] Changelog 파일 자동 업데이트하기
changelog-updater Action
changelog-updater Action
는 GitHub
의 마지막 Release note
를 CHANGELOG.md
파일로 복사하는 GitHub Actions
입니다.
changelog-updater Action
를 사용하기 위해 .github/workflows/update-changelog.yml
파일을 만들고 다음과 같이 수정합니다.
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
이와 같이 작성하면, Release note
가 배포되면, 배포된 내용을 CHANGELOG.md
파일로 복사하게 됩니다. 물론, git
로 관리하는 파일을 수정하는 것이므로, commit_message
를 사용하여 commit
을 하게 됩니다.
CHANGELOG.md 파일
changelog-update Action
을 사용하여 CHANGELOG.md
파일을 업데이트하기 위해서는, CHANGELOG.md
파일이 존재해야 합니다. CHANGELOG.md
파일을 만들고 다음과 같이 수정합니다.
# Changelog
changelog-update Action
을 사용하여 CHANGELOG.md
파일을 업데이트하기 위해서는, CHANGELOG.md
파일이 존재해야 하며, 하나 이상의 heading
이 존재해야 합니다.
이번 블로그 포스트에서는 # Changelog
을 사용하였습니다.
이제 Release note
가 released
되면, CHANGELOG.md
파일이 다음과 같이 업데이트 되는 것을 확인할 수 있습니다.

Release Drafter
GitHub
에서 Release note
를 자동화하기 위한 GitHub Actions
중 하나인 Release Drafter
를 사용할 수 있습니다. Release Drafter
를 사용하는 방법에 대해서는 다음 링크를 참고하시기 바랍니다.
Release Drafter
와 사용할 때에는 주의해서 사용해야 합니다. 자세한 내용은 아래 링크를 참고하시기 바랍니다.
저의 경우는 다음과 같이 Git Tag
가 추가되었을 때, Release note
내용을 CHANGELOG.md
파일로 복사 한 후, Release note
를 배포하도록 하였습니다.
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
이 코드는 Flutter
패키지를 배포하는 GitHub Actions
를 포함하고 있습니다. 따라서 이 부분이 불필요하신 분들은 다음 코드를 자신의 상황에 맞게 수정하여 사용하시면 됩니다.
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: $
...
만약 Flutter
패키지를 제작하고 배포하는 방법에 대해서는 다음 링크를 참고하시기 바랍니다.
완료
이것으로 GitHub Actions
의 changelog-updater Action
을 사용하여 GitHub
의 Release note
에 작성된 내용을 CHANGELOG.md
파일에 자동으로 복사하는 방법에 대해서 알아보았습니다. GitHub
의 Release note
도 사용하고 CHANGELOG.md
파일도 사용한다면, changelog-updater Action
를 통해 자동화를 시도해 보시기 바랍니다.
제 블로그가 도움이 되셨나요? 하단의 댓글을 달아주시면 저에게 큰 힘이 됩니다!
앱 홍보
Deku
가 개발한 앱을 한번 사용해보세요.Deku
가 개발한 앱은 Flutter로 개발되었습니다.관심있으신 분들은 앱을 다운로드하여 사용해 주시면 정말 감사하겠습니다.