@@ -156,12 +156,65 @@ jobs:
156156 permissions :
157157 contents : write
158158 steps :
159+ - name : Checkout
160+ uses : actions/checkout@v4
161+
159162 - name : Download artifacts
160163 uses : actions/download-artifact@v4
161164 with :
162165 path : dist
163166
167+ - name : Build release notes from CHANGELOG
168+ id : notes
169+ shell : bash
170+ run : |
171+ set -euo pipefail
172+ TAG='${{ github.ref_name }}'
173+ VER="${TAG#v}"
174+ export VER
175+ python3 - <<'PY' > release_notes.md
176+ import os
177+
178+ ver = os.environ["VER"]
179+ path = 'CHANGELOG.md'
180+
181+ with open(path, 'r', encoding='utf-8') as f:
182+ lines = f.read().splitlines()
183+
184+ header = f"## [{ver}]"
185+ start = None
186+ for i, line in enumerate(lines):
187+ if line.startswith(header):
188+ start = i
189+ break
190+ if start is None:
191+ raise SystemExit(f"Could not find changelog section for {header}")
192+
193+ out = []
194+ for line in lines[start:]:
195+ if line.startswith('## [') and not line.startswith(header):
196+ break
197+ out.append(line)
198+
199+ # Drop the header line itself (we'll use a nicer title in the GH release)
200+ out = out[1:]
201+ while out and out[0].strip() == '':
202+ out.pop(0)
203+
204+ print(f"## What's changed\n")
205+ print("\n".join(out).rstrip() + "\n")
206+ PY
207+
208+ {
209+ echo 'body<<EOF'
210+ cat release_notes.md
211+ echo 'EOF'
212+ } >> "$GITHUB_OUTPUT"
213+
164214 - name : Create GitHub release and upload assets
165215 uses : softprops/action-gh-release@v2
166216 with :
217+ tag_name : ${{ github.ref_name }}
218+ name : unlost ${{ github.ref_name }}
219+ body : ${{ steps.notes.outputs.body }}
167220 files : dist/**
0 commit comments