-
Notifications
You must be signed in to change notification settings - Fork 26
/
update-gh-pages.sh
executable file
·30 lines (23 loc) · 848 Bytes
/
update-gh-pages.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
#!/bin/sh
set -eu
branch_name=$(git symbolic-ref --short HEAD)
if [ "$branch_name" != "gh-pages" ]; then
echo "Run this script on the gh-pages branch"
exit 1
fi
# Make sure we're building with the latest version of the lib and example app
git fetch
git reset --hard origin/main
# Do a clean build of the web demo app
(cd examples/web && rm -rf node_modules && npm ci && npm run build)
# Copy resources to the docs/ folder, which GitHub Pages is served from
rm -rf docs/
mkdir -p docs/
cp -R examples/web/index.html examples/web/ocr-app.css examples/web/build docs/
cp examples/web/node_modules/tesseract-wasm/dist/tesseract-* docs/build/
# Build API docs
make api-docs
# Commit updated build.
git add docs
git commit -m "Update GitHub Pages"
echo 'GitHub Pages build updated. Run `git push origin --force HEAD` to update the live site.'