forked from BigBoot/AutoKuma
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.pre-release-hook
More file actions
24 lines (20 loc) · 868 Bytes
/
.pre-release-hook
File metadata and controls
24 lines (20 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
cp ../logo.svg ./
export CONTENT=$(markdown-extract "${CRATE_NAME//-/ }" ../README.md | sed 's/\\/\\\\&/g' | sed 's/&/\\&/g')
export HEADER=$(markdown-extract HEADER ../README.md | sed 's/\\/\\\\&/g' | sed 's/&/\\&/g' | \
sed 's|href="#autokuma--"|href="https://crates.io/crates/autokuma"|g' | \
sed 's|href="#kuma-cli---"|href="https://crates.io/crates/kuma-cli"|g' | \
sed 's|href="#kuma-client--"|href="https://crates.io/crates/kuma-client"|g' \
)
read -r -d '' EXAMPLES << EOM
\`\`\`rust
$(cat ../kuma-client/examples/get_monitors.rs)
\`\`\`
\`\`\`rust
$(cat ../kuma-client/examples/create_monitor.rs)
\`\`\`
EOM
export EXAMPLES
awk '{gsub("<!-- CONTENT -->", ENVIRON["CONTENT"])}1' _README.md | \
awk '{gsub("<!-- HEADER -->", ENVIRON["HEADER"])}1'| \
awk '{gsub("<!-- EXAMPLES -->", ENVIRON["EXAMPLES"])}1' > README.md