Skip to content

Commit fca89e6

Browse files
committed
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
1 parent 73349c6 commit fca89e6

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,36 @@ jobs:
4949
python --version
5050
python -c "import sys; assert sys.version_info >= (3, 10), f'Python {sys.version} is not >= 3.10'"
5151
52+
- name: Verify version consistency
53+
run: |
54+
TAG_VERSION="${{ steps.get_version.outputs.VERSION }}"
55+
PKG_VERSION=$(python -c "import skill_seekers; print(skill_seekers.__version__)")
56+
TOML_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
57+
echo "Tag version: $TAG_VERSION"
58+
echo "Package version: $PKG_VERSION"
59+
echo "TOML version: $TOML_VERSION"
60+
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
61+
echo "::error::Version mismatch! Tag=$TAG_VERSION but package reports=$PKG_VERSION"
62+
exit 1
63+
fi
64+
if [ "$TAG_VERSION" != "$TOML_VERSION" ]; then
65+
echo "::error::Version mismatch! Tag=$TAG_VERSION but pyproject.toml has=$TOML_VERSION"
66+
exit 1
67+
fi
68+
echo "✅ All versions match: $TAG_VERSION"
69+
5270
- name: Create Release Notes
5371
id: release_notes
5472
run: |
5573
if [ -f CHANGELOG.md ]; then
56-
# Extract changelog for this version
57-
sed -n "/## \[${{ steps.get_version.outputs.VERSION }}\]/,/## \[/p" CHANGELOG.md | sed '$d' > release_notes.md
58-
else
59-
echo "Release ${{ steps.get_version.outputs.VERSION }}" > release_notes.md
74+
# Extract changelog for this version (escape dots for exact match)
75+
VERSION="${{ steps.get_version.outputs.VERSION }}"
76+
ESCAPED_VERSION=$(echo "$VERSION" | sed 's/\./\\./g')
77+
sed -n "/## \[${ESCAPED_VERSION}\]/,/## \[/p" CHANGELOG.md | sed '$d' > release_notes.md
78+
fi
79+
# Fallback if extraction produced empty file or CHANGELOG.md missing
80+
if [ ! -s release_notes.md ]; then
81+
echo "Release v${{ steps.get_version.outputs.VERSION }}" > release_notes.md
6082
fi
6183
6284
- name: Check if release exists
@@ -74,6 +96,8 @@ jobs:
7496
if: steps.check_release.outputs.exists == 'false'
7597
uses: softprops/action-gh-release@v1
7698
with:
99+
name: v${{ steps.get_version.outputs.VERSION }}
100+
tag_name: ${{ github.ref_name }}
77101
body_path: release_notes.md
78102
draft: false
79103
prerelease: false

0 commit comments

Comments
 (0)