Skip to content

Commit 825b117

Browse files
committed
fix: improve release notes generation logic in workflow
1 parent faa0581 commit 825b117

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

.github/workflows/release_and_deploy.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,20 @@ jobs:
185185
- name: Set POM version env variable
186186
run: echo "POM_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
187187
- name: Create Release Notes
188-
run: awk -v VERSION_DIVIDER="${{ vars.VERSION_DIVIDER }} '$0 ~ VERSION_DIVIDER/{if(flag)exit; flag=1; next} flag' ./CHANGELOG.md > RELEASE_NOTES.md
188+
run: |
189+
VERSION_DIVIDER="${{ vars.VERSION_DIVIDER || '## Version ' }}"
190+
awk -v version_divider="$VERSION_DIVIDER" '
191+
$0 ~ version_divider {
192+
if (count == 0) {
193+
count++;
194+
next
195+
} else if (count == 1) {
196+
exit
197+
}
198+
}
199+
count == 1 {
200+
print
201+
}' ./CHANGELOG.md > RELEASE_NOTES.md
189202
- name: Create Release
190203
id: create_release
191204
uses: softprops/action-gh-release@v2

0 commit comments

Comments
 (0)