Skip to content

Commit 2cbce51

Browse files
committed
Enhance GitHub release workflow to include automatic release notes and populate template with PR and commit information
1 parent f9b0a5c commit 2cbce51

File tree

2 files changed

+45
-29
lines changed

2 files changed

+45
-29
lines changed

.github/RELEASE_TEMPLATE.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Winhance v[VERSION] Release
2-
31
## What's New
42
<!-- List new features and improvements -->
53
-
@@ -17,12 +15,12 @@
1715
**Important:** Please verify your download using the information below. Any file with different values for this particular version is not from the official source.
1816

1917
- **Winhance.Installer.exe**
20-
- Size: [SIZE_BYTES] bytes : [SIZE_MIB] MiB
21-
- SHA256: [INSTALLER_SHA256]
18+
- Size:
19+
- SHA256:
2220

2321
- **Winhance.exe**
24-
- Size: [SIZE_BYTES] bytes : [SIZE_KIB] KiB
25-
- SHA256: [EXE_SHA256]
22+
- Size:
23+
- SHA256:
2624

2725
## Known Issues
2826
<!-- List known issues -->
@@ -31,7 +29,7 @@
3129
## Installation
3230
Download from [winhance.net](https://winhance.net) or directly from this release.
3331

34-
The `Winhance.Installer.exe` includes both Installable and Portable versions during setup.
32+
The Winhance.Installer.exe includes both Installable and Portable versions during setup.
3533

3634
## Compatibility
3735
- Windows 10/11

.github/workflows/create-release.yml

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
- name: Get release template
2626
id: get_template
2727
run: |
28-
if [ -f ".github/RELEASE_TEMPLATE_SIMPLIFIED.md" ]; then
29-
template=$(cat .github/RELEASE_TEMPLATE_SIMPLIFIED.md)
28+
if [ -f ".github/RELEASE_TEMPLATE.md" ]; then
29+
template=$(cat .github/RELEASE_TEMPLATE.md)
3030
echo "TEMPLATE<<EOF" >> $GITHUB_OUTPUT
3131
echo "$template" >> $GITHUB_OUTPUT
3232
echo "EOF" >> $GITHUB_OUTPUT
@@ -93,41 +93,58 @@ jobs:
9393
echo "PULL_REQUESTS<<EOF" >> $GITHUB_OUTPUT
9494
echo "$pr_list" >> $GITHUB_OUTPUT
9595
echo "EOF" >> $GITHUB_OUTPUT
96+
97+
echo "PREVIOUS_TAG=$previous_tag" >> $GITHUB_OUTPUT
9698
shell: bash
9799

98-
- name: Create simple release notes
100+
- name: Create enhanced release notes
99101
id: release_notes
100102
run: |
101103
version="${{ steps.get_version.outputs.VERSION }}"
102104
commits="${{ steps.get_commits.outputs.COMMITS }}"
103105
pull_requests="${{ steps.get_commits.outputs.PULL_REQUESTS }}"
106+
current_tag="${GITHUB_REF#refs/tags/}"
107+
108+
# Get the template content
109+
template_content="${{ steps.get_template.outputs.TEMPLATE }}"
104110
105-
# Start with a basic template
106-
notes="# Winhance v$version Release\n\n"
111+
# Start with the template and replace version placeholders
112+
notes="$template_content"
113+
notes="${notes/VERSION/$version}"
107114
108-
# Add What's New section with commits or PRs
109-
notes="${notes}## What's New\n"
115+
# Populate What's New section with PRs
110116
if [ ! -z "$pull_requests" ]; then
111-
notes="${notes}$pull_requests\n"
112-
elif [ ! -z "$commits" ]; then
113-
notes="${notes}$commits\n"
117+
# Replace the placeholder in What's New section
118+
notes="${notes/\<!-- List new features and improvements --\>\n- /$pull_requests}"
114119
else
115-
notes="${notes}- Updates and improvements\n"
120+
# If no PRs, use commits for What's New
121+
notes="${notes/\<!-- List new features and improvements --\>\n- /$commits}"
116122
fi
117123
118-
# Add Installation section
119-
notes="${notes}\n## Installation\n"
120-
notes="${notes}Download from [winhance.net](https://winhance.net) or directly from this release.\n\n"
121-
notes="${notes}The Winhance.Installer.exe includes both Installable and Portable versions during setup.\n\n"
124+
# Extract bug fix related commits
125+
bug_fixes=$(echo "$commits" | grep -i "fix\|bug\|issue\|crash\|error" || echo "")
126+
127+
# If we found bug fixes, populate the Bug Fixes section
128+
if [ ! -z "$bug_fixes" ]; then
129+
notes="${notes/\<!-- List fixed issues --\>\n- /$bug_fixes}"
130+
else
131+
# If no bug fixes found, leave a placeholder
132+
notes="${notes/\<!-- List fixed issues --\>\n- /- No specific bug fixes in this release\n}"
133+
fi
122134
123-
# Add Compatibility section
124-
notes="${notes}## Compatibility\n"
125-
notes="${notes}- Windows 10/11\n"
126-
notes="${notes} - Tested on Windows 10 x64 22H2 and Windows 11 24H2\n\n"
135+
# Get previous tag from the get_commits step output
136+
previous_tag="${{ steps.get_commits.outputs.PREVIOUS_TAG }}"
137+
138+
# If previous_tag is empty, use a fallback
139+
if [ -z "$previous_tag" ]; then
140+
# Add a link to the full changelog on GitHub without comparison
141+
changelog_link="\n\n**Full Changelog**: https://github.com/memstechtips/Winhance/commits/$current_tag"
142+
else
143+
# Add a link to the full changelog on GitHub with comparison
144+
changelog_link="\n\n**Full Changelog**: https://github.com/memstechtips/Winhance/compare/$previous_tag...$current_tag"
145+
fi
127146
128-
# Add Feedback section
129-
notes="${notes}## Feedback\n"
130-
notes="${notes}Please report any issues on the [GitHub Issues page](https://github.com/memstechtips/Winhance/issues)\n"
147+
notes="${notes/## Known Issues/$changelog_link\n\n## Known Issues}"
131148
132149
echo "NOTES<<EOF" >> $GITHUB_OUTPUT
133150
echo -e "$notes" >> $GITHUB_OUTPUT
@@ -142,5 +159,6 @@ jobs:
142159
body: ${{ steps.release_notes.outputs.NOTES }}
143160
draft: true # Create as draft so you can upload files manually
144161
prerelease: ${{ contains(github.ref, 'beta') || contains(github.ref, 'alpha') }}
162+
generate_release_notes: true # Enable GitHub's automatic release notes generation
145163
env:
146164
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)