The grep/sed only matched unscoped conventional-commit subjects
("feat: ...", "fix: ..."), so every scoped commit ("feat(server): ...")
was silently dropped from the generated changelog entry. Both 5.4.4 and
5.4.5 needed a manual follow-up fix for this. Broaden the pattern to
accept an optional (scope) and drop it from the changelog line.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uc9V1v7iXruubpoLiSE24M
34 lines
1.4 KiB
Bash
Executable File
34 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
uv version --bump patch
|
|
VER=$(uv version --short)
|
|
sed -i".bak" "s/__version__ = \"[0-9.]*\"\(.*\)$/__version__ = \"$VER\"\1/" hbd/__init__.py
|
|
sed -i".bak" "s/__version__ = \"[0-9.]*\"\(.*\)$/__version__ = \"$VER\"\1/" scripts/hbc_mini.py
|
|
sed -i".bak" "s/\*\*Package:\*\* \`hbd\` v[0-9.]*/\*\*Package:\*\* \`hbd\` v$VER/" README.md
|
|
|
|
# Update CHANGELOG.md with commits since last tag
|
|
LASTTAG=$(git describe --tags --abbrev=0 2>/dev/null || true)
|
|
# Matches both unscoped ("feat: ...") and scoped ("feat(server): ...") conventional-commit
|
|
# subjects; the scope is dropped from the changelog line.
|
|
ADDED=$(git log "${LASTTAG:+$LASTTAG..}HEAD" --pretty="%s" | grep -E "^feat(\([^)]*\))?:" | sed -E 's/^feat(\([^)]*\))?: /- /')
|
|
FIXED=$(git log "${LASTTAG:+$LASTTAG..}HEAD" --pretty="%s" | grep -E "^fix(\([^)]*\))?:" | sed -E 's/^fix(\([^)]*\))?: /- /')
|
|
{
|
|
printf "## [%s]\n" "$VER"
|
|
[ -n "$ADDED" ] && printf "\n### Added\n%s\n" "$ADDED"
|
|
[ -n "$FIXED" ] && printf "\n### Fixed\n%s\n" "$FIXED"
|
|
printf "\n---\n\n"
|
|
} > /tmp/changelog_entry.txt
|
|
sed -i".bak" "4r /tmp/changelog_entry.txt" CHANGELOG.md
|
|
rm /tmp/changelog_entry.txt CHANGELOG.md.bak
|
|
|
|
# commit pyproject.toml
|
|
git commit -m "version $VER" pyproject.toml hbd/__init__.py scripts/hbc_mini.py README.md CHANGELOG.md
|
|
git push
|
|
# tag version
|
|
git tag -a v$VER -m "Version $VER"
|
|
git push --tags
|
|
|
|
rm hbd/__init__.py.bak
|
|
rm scripts/hbc_mini.py.bak
|
|
rm README.md.bak |