forked from w3c/ServiceWorker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile.sh
executable file
·33 lines (27 loc) · 982 Bytes
/
compile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
set -e # Exit with nonzero exit code if anything fails
curlretry() {
curl --retry 2 "$@"
}
curlbikeshed() {
INPUT_FILE=$(find . -maxdepth 1 -name "*.bs" -print -quit)
# The Accept: header ensures we get the error output even when warnings are produced, per
# https://github.com/whatwg/whatwg.org/issues/227#issuecomment-419969339.
HTTP_STATUS=$(curlretry https://api.csswg.org/bikeshed/ \
--output "$1" \
--write-out "%{http_code}" \
--header "Accept: text/plain, text/html" \
-F die-on=error \
-F file=@"$INPUT_FILE" \
"${@:2}")
if [[ "$HTTP_STATUS" != "200" ]]; then
cat "$1"
rm -f "$1"
exit 22
fi
}
cd docs && curlbikeshed "index.html"
if [ -d out ]; then
echo Copy the generated spec into out/index.html
cp index.html out/index.html
fi