diff --git a/release.sh b/release.sh index 3f193086227..f0983d094be 100644 --- a/release.sh +++ b/release.sh @@ -26,7 +26,12 @@ update_changelog() { local match='## \[unreleased\] \- unreleased' local heading="## [$version] - $release_date" - sed -i "/$match/c $heading" CHANGELOG.md + case $OSTYPE in + darwin*) + sed -i '' -E "/$match/c $heading" CHANGELOG.md;; + *) + sed -i "/$match/c $heading" CHANGELOG.md;; + esac } remove_empty_sections() { @@ -36,7 +41,12 @@ remove_empty_sections() { local first_word=`echo $str_after | head -n1 | cut -d " " -f1` if [ $first_word != "-" ]; then echo "Removing empty CHANGELOG section: $section" - sed -i "0,/### $section/{//d;}" CHANGELOG.md + case $OSTYPE in + darwin*) + sed -i '' -E "0,/### $section/{//d;}" CHANGELOG.md;; + *) + sed -i "0,/### $section/{//d;}" CHANGELOG.md;; + esac fi done } @@ -44,7 +54,12 @@ remove_empty_sections() { add_changelog_unreleased_section() { echo "Adding unreleased section to CHANGELOG" local replace='## [unreleased] - unreleased\n\n### Fixed\n\n\n### Added\n\n\n### Changed\n\n\n' - sed -i "/## \[$version\] \- $release_date/i $replace" CHANGELOG.md + case $OSTYPE in + darwin*) + sed -i '' -E "/## \[$version\] \- $release_date/i $replace" CHANGELOG.md;; + *) + sed -i "/## \[$version\] \- $release_date/i $replace" CHANGELOG.md;; + esac }