Hotfix/fix release notes #9
1 changed files with 20 additions and 2 deletions
|
|
@ -131,14 +131,32 @@ jobs:
|
|||
fi
|
||||
|
||||
# Replace placeholders in template
|
||||
# Handle COMMITS separately due to multi-line content that can break sed
|
||||
# First, replace all single-line placeholders
|
||||
sed -e "s|{{VERSION}}|$VERSION|g" \
|
||||
-e "s|{{IMAGE_NAME}}|$IMAGE_NAME|g" \
|
||||
-e "s|{{COMMIT_HASH}}|$COMMIT_HASH|g" \
|
||||
-e "s|{{COMMIT_SHORT}}|$COMMIT_SHORT|g" \
|
||||
-e "s|{{BUILD_DATE}}|$BUILD_DATE|g" \
|
||||
-e "s|{{COMMIT_AUTHOR}}|$COMMIT_AUTHOR|g" \
|
||||
-e "s|{{COMMITS}}|$COMMITS|g" \
|
||||
"$TEMPLATE_FILE" > /tmp/release_message.txt
|
||||
"$TEMPLATE_FILE" > /tmp/release_message_temp.txt
|
||||
|
||||
# Replace COMMITS placeholder - use a while loop to handle multi-line safely
|
||||
if [[ -n "$COMMITS" ]]; then
|
||||
# Write COMMITS to a temp file and use it for replacement
|
||||
echo "$COMMITS" > /tmp/commits.txt
|
||||
# Use a simple approach: read template line by line and replace
|
||||
while IFS= read -r line; do
|
||||
if [[ "$line" == *"{{COMMITS}}"* ]]; then
|
||||
cat /tmp/commits.txt
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
done < /tmp/release_message_temp.txt > /tmp/release_message.txt
|
||||
else
|
||||
# If no commits, just remove the placeholder
|
||||
sed 's|{{COMMITS}}||g' /tmp/release_message_temp.txt > /tmp/release_message.txt
|
||||
fi
|
||||
|
||||
echo "Release notes generated from template"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue