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:
32
.github/workflows/release.yml
vendored
32
.github/workflows/release.yml
vendored
@@ -49,14 +49,36 @@ jobs:
|
||||
python --version
|
||||
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
|
||||
id: release_notes
|
||||
run: |
|
||||
if [ -f CHANGELOG.md ]; then
|
||||
# Extract changelog for this version
|
||||
sed -n "/## \[${{ steps.get_version.outputs.VERSION }}\]/,/## \[/p" CHANGELOG.md | sed '$d' > release_notes.md
|
||||
else
|
||||
echo "Release ${{ steps.get_version.outputs.VERSION }}" > release_notes.md
|
||||
# Extract changelog for this version (escape dots for exact match)
|
||||
VERSION="${{ steps.get_version.outputs.VERSION }}"
|
||||
ESCAPED_VERSION=$(echo "$VERSION" | sed 's/\./\\./g')
|
||||
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
|
||||
|
||||
- name: Check if release exists
|
||||
@@ -74,6 +96,8 @@ jobs:
|
||||
if: steps.check_release.outputs.exists == 'false'
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: v${{ steps.get_version.outputs.VERSION }}
|
||||
tag_name: ${{ github.ref_name }}
|
||||
body_path: release_notes.md
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
Reference in New Issue
Block a user