@@ -485,31 +485,22 @@ jobs:
485485 with :
486486 fetch-depth : 0 # get all tags
487487
488- - name : Get release notes
489- id : get_release_notes
490- run : |
491- # Get the latest tag
492- latest_tag=$(git describe --tags --abbrev=0)
493- echo "latest_tag=${latest_tag}" >> $GITHUB_ENV
494-
495- # Extract release notes from CHANGELOG.md
496- # This script extracts the content between the latest tag and the previous tag.
497- notes=$(awk -v tag="## [${latest_tag##v}]" '
498- BEGIN { p = 0 }
499- index($0, tag) { p = 1; next }
500- p && /^## / { exit }
501- p { print }
502- ' CHANGELOG.md)
503- echo "notes<<EOF" >> $GITHUB_OUTPUT
504- echo "$notes" >> $GITHUB_OUTPUT
505- echo "EOF" >> $GITHUB_OUTPUT
488+ - name : Generate a changelog
489+ uses : orhun/git-cliff-action@v4
490+ id : git-cliff
491+ with :
492+ config : cliff.toml
493+ args : -vv --latest --strip header
494+ env :
495+ OUTPUT : CHANGELOG.md
496+ GITHUB_REPO : ${{ github.repository }}
506497
507498 - name : Create Release
508499 uses : softprops/action-gh-release@v2
509500 with :
510- tag_name : ${{ env.latest_tag }}
511- name : " Release ${{ env.latest_tag }}"
512- body : ${{ steps.get_release_notes .outputs.notes }}
501+ tag_name : ${{ github.ref_name }}
502+ name : " Release ${{ github.ref_name }}"
503+ body : ${{ steps.git-cliff .outputs.content }}
513504 draft : false
514505 prerelease : contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc')
515506 env :
0 commit comments