v1.0.4 #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate changelog | |
on: | |
release: | |
types: [created, edited, published] | |
pull_request: | |
types: [closed] | |
workflow_run: | |
workflows: ["Create release"] # release.yml의 name과 일치해야 함 | |
types: | |
- completed | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
generate-changelog: | |
runs-on: ubuntu-latest | |
if: | | |
github.event_name == 'workflow_dispatch' || | |
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') || | |
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get first tag | |
id: get_first_tag | |
run: | | |
# 시맨틱 버전 태그 중 가장 최신 버전 찾기 (v1 제외) | |
latest_tag="$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n1)" | |
echo "LATEST_TAG=${latest_tag}" >> "$GITHUB_ENV" | |
# 첫 번째 태그는 v1.0.0으로 고정 | |
echo "FIRST_TAG=v1.0.0" >> "$GITHUB_ENV" | |
- name: Generate changelog | |
uses: janheinrichmerker/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
futureRelease: ${{ github.event.release.tag_name || env.LATEST_TAG }} | |
output: CHANGELOG.md | |
sinceTag: ${{ env.FIRST_TAG }} # v1.0.0과 같은 구체적인 버전 태그 | |
# excludeTags: "v1,v2" # 명시적으로 제외할 태그 | |
excludeTagsRegex: "^v[0-9]$" | |
- name: Commit files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add CHANGELOG.md | |
git commit -m "Update changelog" || echo "No changes to commit" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |