fix(ci): redirect script messages to stderr and support version format X.Y.Z-suffix

Fixed workflow failure by ensuring only data goes to stdout, not informational messages. Also added support for version format X.Y.Z-suffix in addition to X.Y.Z+build.
This commit is contained in:
Achintha Isuru
2026-03-05 14:10:05 -05:00
parent bdacedbced
commit be43030058
6 changed files with 52 additions and 52 deletions

View File

@@ -11,8 +11,8 @@ TAG_NAME=$4
OUTPUT_FILE=$5
if [ -z "$APP" ] || [ -z "$VERSION" ] || [ -z "$ENV" ] || [ -z "$TAG_NAME" ] || [ -z "$OUTPUT_FILE" ]; then
echo "❌ Error: Missing required parameters"
echo "Usage: ./extract-release-notes.sh <app> <version> <environment> <tag_name> <output_file>"
echo "❌ Error: Missing required parameters" >&2
echo "Usage: ./extract-release-notes.sh <app> <version> <environment> <tag_name> <output_file>" >&2
exit 1
fi
@@ -27,14 +27,14 @@ fi
# Try to extract release notes for this version
if [ -f "$CHANGELOG_PATH" ]; then
echo "📝 Found CHANGELOG at $CHANGELOG_PATH"
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')
if [ -z "$NOTES" ]; then
echo "⚠️ Warning: No CHANGELOG entry found for version $VERSION"
echo "⚠️ Warning: No CHANGELOG entry found for version $VERSION" >&2
NOTES="Release $VERSION for $APP_NAME
⚠️ No CHANGELOG entry found for this version. Please update the CHANGELOG manually.
@@ -42,7 +42,7 @@ if [ -f "$CHANGELOG_PATH" ]; then
**Environment:** $ENV
**Tag:** $TAG_NAME"
else
echo "✅ Extracted release notes for version $VERSION"
echo "✅ Extracted release notes for version $VERSION" >&2
NOTES="# $APP_NAME - Release $VERSION
$NOTES
@@ -53,7 +53,7 @@ $NOTES
**Tag:** $TAG_NAME"
fi
else
echo "⚠️ Warning: CHANGELOG not found at $CHANGELOG_PATH"
echo "⚠️ Warning: CHANGELOG not found at $CHANGELOG_PATH" >&2
NOTES="Release $VERSION for $APP_NAME
**Environment:** $ENV
@@ -62,4 +62,4 @@ fi
# Save to output file
echo "$NOTES" > "$OUTPUT_FILE"
echo "✅ Release notes saved to $OUTPUT_FILE"
echo "✅ Release notes saved to $OUTPUT_FILE" >&2