Fix release notes extraction in workflow
- Replace sed with awk for more reliable multiline extraction - Use temp file to capture full script output - Extract content between separator lines correctly - Fixes empty release notes in draft releases Previous issue: sed pattern wasn't matching the separator lines, resulting in empty RELEASE_NOTES variable. New approach: Use awk to capture everything between the two separator lines, handling multiline content properly. Related to #671 (automated release workflow)
This commit is contained in:
parent
c27f21f33b
commit
ea165e0bcc
1 changed files with 9 additions and 2 deletions
11
.github/workflows/release.yml
vendored
11
.github/workflows/release.yml
vendored
|
|
@ -174,8 +174,15 @@ jobs:
|
|||
|
||||
echo "Comparing v${{ inputs.version }} with ${PREVIOUS_TAG}..."
|
||||
|
||||
# Generate notes and capture output
|
||||
RELEASE_NOTES=$(./scripts/generate-release-notes.sh ${{ inputs.version }} "${PREVIOUS_TAG}" 2>&1 | sed -n '/^Generated release notes:/,/^━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$/{ /^Generated release notes:/d; /^━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$/d; p; }')
|
||||
# Generate notes - script writes output between separator lines
|
||||
# We need to capture everything between the separators
|
||||
TEMP_OUTPUT=$(mktemp)
|
||||
./scripts/generate-release-notes.sh ${{ inputs.version }} "${PREVIOUS_TAG}" > "$TEMP_OUTPUT" 2>&1
|
||||
|
||||
# Extract notes between separator lines (everything between the two ━━━ lines)
|
||||
RELEASE_NOTES=$(awk '/^Generated release notes:/{flag=1;next}/^━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$/{if(flag==1){flag=2}else if(flag==2){flag=3}}flag==2' "$TEMP_OUTPUT")
|
||||
|
||||
rm -f "$TEMP_OUTPUT"
|
||||
|
||||
# Save to output (escape for GitHub Actions multiline)
|
||||
echo "RELEASE_NOTES<<EOF" >> $GITHUB_OUTPUT
|
||||
|
|
|
|||
Loading…
Reference in a new issue