MNT: Add sitemap.txt generation for gh-pages

This commit is contained in:
Kernc
2019-01-11 19:16:53 +01:00
parent 74f0f9b8de
commit 8ab04bacc8

View File

@@ -8,12 +8,23 @@ fi
[ "$GH_PASSWORD" ] || exit 12 [ "$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) head=$(git rev-parse HEAD)
git clone -b gh-pages "https://kernc:$GH_PASSWORD@github.com/$TRAVIS_REPO_SLUG.git" gh-pages git clone -b gh-pages "https://kernc:$GH_PASSWORD@github.com/$TRAVIS_REPO_SLUG.git" gh-pages
mkdir -p gh-pages/doc mkdir -p gh-pages/doc
cp -R doc/build/* gh-pages/doc/ cp -R doc/build/* gh-pages/doc/
cd gh-pages cd gh-pages
sitemap
git add * git add *
git diff --staged --quiet && echo "$0: No changes to commit." && exit 0 git diff --staged --quiet && echo "$0: No changes to commit." && exit 0
git commit -a -m "CI: Update docs for $TRAVIS_TAG ($head)" git commit -a -m "CI: Update docs for $TRAVIS_TAG ($head)"