forked from kernc/backtesting.py
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-gh-pages.sh
More file actions
31 lines (26 loc) · 784 Bytes
/
deploy-gh-pages.sh
File metadata and controls
31 lines (26 loc) · 784 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
25
26
27
28
29
30
31
#!/bin/bash
set -eu
if [ ! -d doc/build ]; then
echo 'Error: invalid directory. Deploy from repo root.'
exit 1
fi
[ "$GH_PASSWORD" ] || exit 12
sitemap() {
WEBSITE='https://kernc.github.io/backtesting.py'
find -name '*.html' |
sed "s,^\.,$WEBSITE," |
sed 's/index.html$//' |
grep -v '/google.*\.html$' |
sort -u > 'sitemap.txt'
echo "Sitemap: $WEBSITE/sitemap.txt" > 'robots.txt'
}
head=$(git rev-parse HEAD)
git clone -b gh-pages "https://kernc:$GH_PASSWORD@github.com/$TRAVIS_REPO_SLUG.git" gh-pages
mkdir -p gh-pages/doc
cp -R doc/build/* gh-pages/doc/
cd gh-pages
sitemap
git add *
git diff --staged --quiet && echo "$0: No changes to commit." && exit 0
git commit -a -m "CI: Update docs for $TRAVIS_TAG ($head)"
git push