fix: add explicit release name and version consistency checks to release workflow

The GitHub release was showing v3.1.3 instead of v3.2.0 because:
1. No explicit `name` was set on the GitHub release action, relying on
   defaults that could be unreliable
2. The sed command for extracting release notes used unescaped dots in
   the version regex, which could match wrong versions
3. No fallback if release notes extraction produced an empty file

Changes:
- Add explicit `name` and `tag_name` to softprops/action-gh-release
- Add version consistency check (tag vs pyproject.toml vs package)
- Escape dots in sed regex for exact version matching
- Add fallback when release notes extraction produces empty output

https://claude.ai/code/session_015hYfpKhFH3GSMVSKgA4JVd
This commit is contained in:
Claude
2026-03-02 07:10:59 +00:00
parent 73349c616b
commit fca89e6ee1

View File

@@ -49,14 +49,36 @@ jobs:
python --version python --version
python -c "import sys; assert sys.version_info >= (3, 10), f'Python {sys.version} is not >= 3.10'" python -c "import sys; assert sys.version_info >= (3, 10), f'Python {sys.version} is not >= 3.10'"
- name: Verify version consistency
run: |
TAG_VERSION="${{ steps.get_version.outputs.VERSION }}"
PKG_VERSION=$(python -c "import skill_seekers; print(skill_seekers.__version__)")
TOML_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
echo "Tag version: $TAG_VERSION"
echo "Package version: $PKG_VERSION"
echo "TOML version: $TOML_VERSION"
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "::error::Version mismatch! Tag=$TAG_VERSION but package reports=$PKG_VERSION"
exit 1
fi
if [ "$TAG_VERSION" != "$TOML_VERSION" ]; then
echo "::error::Version mismatch! Tag=$TAG_VERSION but pyproject.toml has=$TOML_VERSION"
exit 1
fi
echo "✅ All versions match: $TAG_VERSION"
- name: Create Release Notes - name: Create Release Notes
id: release_notes id: release_notes
run: | run: |
if [ -f CHANGELOG.md ]; then if [ -f CHANGELOG.md ]; then
# Extract changelog for this version # Extract changelog for this version (escape dots for exact match)
sed -n "/## \[${{ steps.get_version.outputs.VERSION }}\]/,/## \[/p" CHANGELOG.md | sed '$d' > release_notes.md VERSION="${{ steps.get_version.outputs.VERSION }}"
else ESCAPED_VERSION=$(echo "$VERSION" | sed 's/\./\\./g')
echo "Release ${{ steps.get_version.outputs.VERSION }}" > release_notes.md sed -n "/## \[${ESCAPED_VERSION}\]/,/## \[/p" CHANGELOG.md | sed '$d' > release_notes.md
fi
# Fallback if extraction produced empty file or CHANGELOG.md missing
if [ ! -s release_notes.md ]; then
echo "Release v${{ steps.get_version.outputs.VERSION }}" > release_notes.md
fi fi
- name: Check if release exists - name: Check if release exists
@@ -74,6 +96,8 @@ jobs:
if: steps.check_release.outputs.exists == 'false' if: steps.check_release.outputs.exists == 'false'
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
name: v${{ steps.get_version.outputs.VERSION }}
tag_name: ${{ github.ref_name }}
body_path: release_notes.md body_path: release_notes.md
draft: false draft: false
prerelease: false prerelease: false