diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c86f1c8..2c38d0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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