File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 87
87
if : startsWith(github.ref, 'refs/tags/')
88
88
run : dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate
89
89
90
+ - name : Generate Release Notes
91
+ if : startsWith(github.ref, 'refs/tags/')
92
+ run : |
93
+ VERSION=${GITHUB_REF#refs/tags/v}
94
+ echo "# Release v$VERSION" > release-notes.md
95
+ echo "" >> release-notes.md
96
+
97
+ # Try to extract section from Changelog.md if it exists
98
+ if [ -f Changelog.md ]; then
99
+ awk -v ver="$VERSION" '
100
+ BEGIN { inSection = 0; }
101
+ $0 ~ "^##v." ver { inSection = 1; next; }
102
+ inSection && $0 ~ "^##" { inSection = 0; }
103
+ inSection { print; }
104
+ ' Changelog.md >> release-notes.md
105
+ fi
106
+
107
+ # If no content was extracted, add a default message
108
+ if [ ! -s release-notes.md ] || [ $(wc -l < release-notes.md) -le 2 ]; then
109
+ echo "# Release v$VERSION" > release-notes.md
110
+ echo "" >> release-notes.md
111
+ echo "See [Changelog.md](https://github.com/${{ github.repository }}/blob/main/Changelog.md) for details." >> release-notes.md
112
+ fi
113
+
114
+ echo "Generated release notes:"
115
+ cat release-notes.md
116
+
90
117
- name : Create GitHub Release
91
118
if : startsWith(github.ref, 'refs/tags/')
92
119
uses : softprops/action-gh-release@v2
You can’t perform that action at this time.
0 commit comments