Skip to content

Commit 50a76ff

Browse files
committed
chore: update workflows
1 parent ede9e52 commit 50a76ff

File tree

1 file changed

+38
-13
lines changed

1 file changed

+38
-13
lines changed

.github/workflows/main.yml

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,10 @@ on:
1515
description: 'Custom version (optional, format: vYY.MM.PATCH)'
1616
required: false
1717
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
2121
type: string
22-
default: |
23-
### Added
24-
-
25-
26-
### Changed
27-
-
28-
29-
### Fixed
30-
-
3122

3223
env:
3324
BINARY_NAME: folderhost
@@ -39,6 +30,7 @@ jobs:
3930
outputs:
4031
version: ${{ steps.version.outputs.version }}
4132
current_date: ${{ steps.date.outputs.current_date }}
33+
release_notes: ${{ steps.changelog.outputs.release_notes }}
4234

4335
steps:
4436
- name: Checkout code
@@ -103,6 +95,39 @@ jobs:
10395
echo "version=$VERSION" >> $GITHUB_OUTPUT
10496
echo "✅ Final version: $VERSION"
10597
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+
106131
- name: Get current date
107132
id: date
108133
run: echo "current_date=$(date +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_OUTPUT
@@ -236,7 +261,7 @@ jobs:
236261
📅 Release Date: ${{ needs.build-and-release.outputs.current_date }}
237262
238263
## 📋 What's New
239-
${{ github.event.inputs.release_notes }}
264+
${{ needs.build-and-release.outputs.release_notes }}
240265
241266
## 📦 Downloads
242267

0 commit comments

Comments
 (0)