Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,42 @@ jobs:
with:
fetch-depth: 0

- name: Generate release notes
- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"

- name: Extract release notes from README version history
id: notes
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
prev_tag=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || true)
notes=$(python3 <<'PY'
import re
from pathlib import Path

version = __import__('os').environ['VERSION']
readme = Path('README.md').read_text()
pattern = re.compile(
rf'^###\s+{re.escape(version)}\s+-.*?\n(.*?)(?=^###\s+|\Z)',
re.MULTILINE | re.DOTALL,
)
match = pattern.search(readme)
if match:
print(match.group(1).strip())
PY
)

if [ -n "$prev_tag" ]; then
echo "Generating changelog from $prev_tag to $GITHUB_REF_NAME"
notes=$(git log --pretty=format:'- %s' "$prev_tag"..HEAD)
if [ -n "$notes" ]; then
echo "Found release notes for v$VERSION in README.md"
else
echo "No previous tag found, using all commits"
notes=$(git log --pretty=format:'- %s')
prev_tag=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || true)
if [ -n "$prev_tag" ]; then
echo "No README entry found; generating notes from $prev_tag to $GITHUB_REF_NAME"
notes=$(git log --pretty=format:'- %s' "$prev_tag"..HEAD)
else
echo "No previous tag found; using all commits for notes"
notes=$(git log --pretty=format:'- %s')
fi
fi

{
Expand Down
Loading