@@ -60,11 +60,40 @@ jobs:
6060 if : steps.get_tag.outputs.tag != ''
6161 run : dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
6262
63+ - name : Extract release notes from CHANGELOG.md
64+ if : steps.get_tag.outputs.tag != ''
65+ id : extract_notes
66+ run : |
67+ VERSION="${{ steps.get_tag.outputs.tag }}"
68+ echo "Extracting notes for version: $VERSION"
69+
70+ NOTES=$(awk -v ver="v$VERSION" '
71+ $0 ~ "^## "ver"$" {flag=1; next}
72+ flag && $0 ~ "^## " {flag=0}
73+ flag
74+ ' <(sed "s/\r$//" CHANGELOG.md) | awk '!/^Release Date:/')
75+ NOTES=$(echo "$NOTES" | sed '/./,$!d' | tac | sed '/./,$!d' | tac)
76+
77+ if [ -z "$NOTES" ]; then
78+ echo "Did not find notes with 'v' prefix, trying without."
79+ NOTES=$(awk -v ver="$VERSION" '
80+ $0 ~ "^## "ver"$" {flag=1; next}
81+ flag && $0 ~ "^## " {flag=0}
82+ flag
83+ ' <(sed "s/\r$//" CHANGELOG.md) | awk '!/^Release Date:/')
84+ NOTES=$(echo "$NOTES" | sed '/./,$!d' | tac | sed '/./,$!d' | tac)
85+ fi
86+
87+ # Set output
88+ echo "notes<<EOF" >> $GITHUB_OUTPUT
89+ echo "$NOTES" >> $GITHUB_OUTPUT
90+ echo "EOF" >> $GITHUB_OUTPUT
91+
6392 - name : Create GitHub Release
6493 if : steps.get_tag.outputs.tag != ''
6594 uses : softprops/action-gh-release@v1
6695 with :
6796 tag_name : ${{ steps.get_tag.outputs.tag }}
68- generate_release_notes : true
97+ body : ${{ steps.extract_notes.outputs.notes }}
6998 env :
7099 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments