Skip to content

Commit ef09ac2

Browse files
fix(ci): resolve sed error in CHANGELOG update step
- Replace sed command with file manipulation using cat - Create temporary file for new changelog entry - Use cat to prepend new content to existing CHANGELOG.md This commit addresses the sed error in the CHANGELOG update script, providing a more robust method for updating the CHANGELOG.md file that can handle multi-line entries and special characters.
1 parent a81455b commit ef09ac2

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,18 @@ jobs:
126126
NEW_VERSION='${{ steps.determine_version.outputs.NEW_VERSION }}'
127127
CHANGELOG='${{ steps.get_changelog.outputs.CHANGELOG }}'
128128
129-
# Escape special characters in CHANGELOG
130-
CHANGELOG_ESCAPED=$(echo "$CHANGELOG" | sed 's/[&/\]/\\&/g')
129+
# Create a temporary file with the new content
130+
cat << EOF > temp_changelog.md
131+
# ${NEW_VERSION}
131132
132-
# Prepend new changes to CHANGELOG.md
133-
sed -i "1i# ${NEW_VERSION}\n\n${CHANGELOG_ESCAPED}\n" CHANGELOG.md
133+
${CHANGELOG}
134+
135+
EOF
136+
137+
# Prepend the new content to the existing CHANGELOG.md
138+
cat temp_changelog.md CHANGELOG.md > updated_changelog.md
139+
mv updated_changelog.md CHANGELOG.md
140+
rm temp_changelog.md
134141
135142
# Commit and push the updated CHANGELOG.md
136143
git config --local user.email "[email protected]"

0 commit comments

Comments
 (0)