feat(ci): update release notes format to new template

Updated extract-release-notes.sh to follow new format:

**Environment:** {ENV}

**Tag:** {TAG}

## What is new in this release

{changelog content}

Improvements:

- Moved environment and tag info to the top

- Added 'What is new in this release' heading

- Improved awk pattern to properly extract changelog sections

- Support both [vX.Y.Z] and [X.Y.Z] version formats in CHANGELOG

- Removes unnecessary app name and separator lines

Testing:

 worker-mobile-app: Extracts content from apps/mobile/apps/staff/CHANGELOG.md

 client-mobile-app: Extracts content from apps/mobile/apps/client/CHANGELOG.md

 Handles [v0.0.1-m3] format correctly
This commit is contained in:
Achintha Isuru
2026-03-05 15:09:32 -05:00
parent 8378ebddea
commit 107ce1d48a

View File

@@ -30,34 +30,40 @@ if [ -f "$CHANGELOG_PATH" ]; then
echo "📝 Found CHANGELOG at $CHANGELOG_PATH" >&2 echo "📝 Found CHANGELOG at $CHANGELOG_PATH" >&2
# Extract section for this version # Extract section for this version
# Look for ## [VERSION] and collect until next ## [ or end of file # Look for ## [vVERSION] or ## [VERSION] and collect content until next ## [ header
NOTES=$(awk "/## \[${VERSION}\]/,/^## \[/" "$CHANGELOG_PATH" | sed '1d;$d' | sed '/^$/d') # 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 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 ⚠️ No CHANGELOG entry found for this version. Please update the CHANGELOG manually."
**Tag:** $TAG_NAME"
else else
echo "✅ Extracted release notes for version $VERSION" >&2 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
--- $CHANGELOG_CONTENT"
**Environment:** $ENV
**Tag:** $TAG_NAME"
fi fi
else else
echo "⚠️ Warning: CHANGELOG not found at $CHANGELOG_PATH" >&2 echo "⚠️ Warning: CHANGELOG not found at $CHANGELOG_PATH" >&2
NOTES="Release $VERSION for $APP_NAME NOTES="**Environment:** $ENV
**Tag:** $TAG_NAME
**Environment:** $ENV ## What is new in this release
**Tag:** $TAG_NAME"
⚠️ CHANGELOG file not found at $CHANGELOG_PATH"
fi fi
# Save to output file # Save to output file