diff --git a/.github/scripts/extract-release-notes.sh b/.github/scripts/extract-release-notes.sh index 5d064a7b..408d969f 100755 --- a/.github/scripts/extract-release-notes.sh +++ b/.github/scripts/extract-release-notes.sh @@ -30,34 +30,40 @@ if [ -f "$CHANGELOG_PATH" ]; then echo "📝 Found CHANGELOG at $CHANGELOG_PATH" >&2 # Extract section for this version - # Look for ## [VERSION] and collect until next ## [ or end of file - NOTES=$(awk "/## \[${VERSION}\]/,/^## \[/" "$CHANGELOG_PATH" | sed '1d;$d' | sed '/^$/d') + # Look for ## [vVERSION] or ## [VERSION] and collect content until next ## [ header + # Try with 'v' prefix first (common format), then without + CHANGELOG_CONTENT=$(awk "/^## \[v${VERSION}\]/{flag=1; next} /^## \[/{flag=0} flag" "$CHANGELOG_PATH") - if [ -z "$NOTES" ]; then + # If still empty, try without 'v' prefix + if [ -z "$CHANGELOG_CONTENT" ]; then + CHANGELOG_CONTENT=$(awk "/^## \[${VERSION}\]/{flag=1; next} /^## \[/{flag=0} flag" "$CHANGELOG_PATH") + fi + + if [ -z "$CHANGELOG_CONTENT" ]; then echo "⚠️ Warning: No CHANGELOG entry found for version $VERSION" >&2 - NOTES="Release $VERSION for $APP_NAME + NOTES="**Environment:** $ENV +**Tag:** $TAG_NAME -⚠️ No CHANGELOG entry found for this version. Please update the CHANGELOG manually. +## What is new in this release -**Environment:** $ENV -**Tag:** $TAG_NAME" +⚠️ No CHANGELOG entry found for this version. Please update the CHANGELOG manually." else echo "✅ Extracted release notes for version $VERSION" >&2 - NOTES="# $APP_NAME - Release $VERSION + NOTES="**Environment:** $ENV +**Tag:** $TAG_NAME -$NOTES +## What is new in this release ---- - -**Environment:** $ENV -**Tag:** $TAG_NAME" +$CHANGELOG_CONTENT" fi else echo "⚠️ Warning: CHANGELOG not found at $CHANGELOG_PATH" >&2 - NOTES="Release $VERSION for $APP_NAME + NOTES="**Environment:** $ENV +**Tag:** $TAG_NAME -**Environment:** $ENV -**Tag:** $TAG_NAME" +## What is new in this release + +⚠️ CHANGELOG file not found at $CHANGELOG_PATH" fi # Save to output file