Skip to content

Commit

Permalink
chore: fix build docs on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
harttle committed Mar 21, 2024
1 parent 1e266c6 commit bca7017
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions bin/build-changelog.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
#!/usr/bin/env bash

# Run `sed` in a way that's compatible with both macOS (BSD) and Linux (GNU)
sedi() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "$@"
else
sed -i "$@"
fi
}

cd docs
cp ../CHANGELOG.md source/tutorials/changelog.md
sedi \
sed -i \
-e 's/{%/{% raw %}{%{% endraw %}/g' \
-e 's/{{/{% raw %}{{{% endraw %}/g' \
-e '1 s/"/\"/g' \
Expand All @@ -20,7 +11,7 @@ sedi \
source/tutorials/changelog.md
cp source/tutorials/changelog.md source/zh-cn/tutorials/changelog.md

sedi -e '1i\
sed -i -e '1i\
---\ntitle: Changelog\nauto: true\n---\n' source/tutorials/changelog.md
sedi -e '1i\
sed -i -e '1i\
---\ntitle: 更新日志\nauto: true\n---\n' source/zh-cn/tutorials/changelog.md

0 comments on commit bca7017

Please sign in to comment.