Generate changelog #41
This file contains hidden or 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@v5 | |
| 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/action-github-changelog-generator@v2.4 | |
| 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: Git Commit and Push | |
| uses: somaz94/go-git-commit-action@v1 | |
| with: | |
| branch: main | |
| commit_message: "Update changelog" | |
| user_email: "actions@github.com" | |
| user_name: "GitHub Actions" | |
| file_pattern: "CHANGELOG.md" | |