|
15 | 15 | description: 'Custom version (optional, format: vYY.MM.PATCH)' |
16 | 16 | required: false |
17 | 17 | type: string |
18 | | - release_notes: |
19 | | - description: 'Release notes (markdown format) - What changed in this release?' |
20 | | - required: true |
| 18 | + release_notes_override: |
| 19 | + description: 'Release notes override (optional, leave empty to auto-read from CHANGELOG.md)' |
| 20 | + required: false |
21 | 21 | type: string |
22 | | - default: | |
23 | | - ### Added |
24 | | - - |
25 | | -
|
26 | | - ### Changed |
27 | | - - |
28 | | -
|
29 | | - ### Fixed |
30 | | - - |
31 | 22 |
|
32 | 23 | env: |
33 | 24 | BINARY_NAME: folderhost |
|
39 | 30 | outputs: |
40 | 31 | version: ${{ steps.version.outputs.version }} |
41 | 32 | current_date: ${{ steps.date.outputs.current_date }} |
| 33 | + release_notes: ${{ steps.changelog.outputs.release_notes }} |
42 | 34 |
|
43 | 35 | steps: |
44 | 36 | - name: Checkout code |
@@ -103,6 +95,39 @@ jobs: |
103 | 95 | echo "version=$VERSION" >> $GITHUB_OUTPUT |
104 | 96 | echo "✅ Final version: $VERSION" |
105 | 97 |
|
| 98 | + - name: Extract release notes from CHANGELOG.md |
| 99 | + id: changelog |
| 100 | + run: | |
| 101 | + if [[ -n "${{ github.event.inputs.release_notes_override }}" ]]; then |
| 102 | + echo "📝 Using manually provided release notes" |
| 103 | + NOTES="${{ github.event.inputs.release_notes_override }}" |
| 104 | + elif [[ ! -f "CHANGELOG.md" ]]; then |
| 105 | + echo "⚠️ CHANGELOG.md not found, using default notes" |
| 106 | + NOTES="No changelog available." |
| 107 | + else |
| 108 | + echo "📖 Reading release notes from CHANGELOG.md [Unreleased] section" |
| 109 | +
|
| 110 | + NOTES=$(awk ' |
| 111 | + /^## \[Unreleased\]/ { found=1; next } |
| 112 | + found && /^## \[/ { exit } |
| 113 | + found { print } |
| 114 | + ' CHANGELOG.md | sed '/^[[:space:]]*$/{ /./!d }' | sed '1{/^$/d}') |
| 115 | +
|
| 116 | + if [[ -z "$NOTES" ]]; then |
| 117 | + echo "⚠️ [Unreleased] section is empty, using default notes" |
| 118 | + NOTES="No unreleased changes documented." |
| 119 | + else |
| 120 | + echo "✅ Successfully extracted changelog notes" |
| 121 | + fi |
| 122 | + fi |
| 123 | +
|
| 124 | + echo "$NOTES" > /tmp/release_notes.txt |
| 125 | + { |
| 126 | + echo "release_notes<<CHANGELOG_EOF" |
| 127 | + cat /tmp/release_notes.txt |
| 128 | + echo "CHANGELOG_EOF" |
| 129 | + } >> $GITHUB_OUTPUT |
| 130 | +
|
106 | 131 | - name: Get current date |
107 | 132 | id: date |
108 | 133 | run: echo "current_date=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT |
@@ -236,7 +261,7 @@ jobs: |
236 | 261 | 📅 Release Date: ${{ needs.build-and-release.outputs.current_date }} |
237 | 262 | |
238 | 263 | ## 📋 What's New |
239 | | - ${{ github.event.inputs.release_notes }} |
| 264 | + ${{ needs.build-and-release.outputs.release_notes }} |
240 | 265 | |
241 | 266 | ## 📦 Downloads |
242 | 267 | |
|
0 commit comments