Skip to content

Commit 1cffcc3

Browse files
committed
Run awk instead of sed to consistently run on mac and linux
1 parent 00b4f4a commit 1cffcc3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

release.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,16 @@ if [[ "$CODE_CHANGED" == true ]]; then
7878
fi
7979

8080
# Insert the new changelog entry below the line "== Changelog =="
81-
# Use sed to insert the changelog entry
82-
sed -i "/== Changelog ==/a \\
83-
\\
84-
$CHANGELOG_ENTRY" ./readme.txt
81+
# Create a temporary file with the new content
82+
ESCAPED_CHANGELOG_ENTRY=$(echo "$CHANGELOG_ENTRY" | sed 's/[\/&*]/\\&/g')
83+
awk -v entry="$ESCAPED_CHANGELOG_ENTRY" '
84+
/== Changelog ==/ {
85+
print $0
86+
print ""
87+
print entry
88+
next
89+
}
90+
{ print }' readme.txt > readme.txt.tmp && mv readme.txt.tmp readme.txt
8591

8692
# Update the config.json file
8793
echo "{

0 commit comments

Comments
 (0)