commit_docs.sh 871 Bytes
Newer Older
1
2
3
4
5
6
#!/usr/bin/env bash

set -ex


if [ "$2" == "" ]; then
moto's avatar
moto committed
7
    echo call as "$0" "<src>" "<target branch>"
8
    echo where src is the root of the built documentation git checkout and
9
10
11
12
    echo branch should be "master" or "1.7" or so
    exit 1
fi

13
src=$1
14
15
target=$2

16
echo "committing docs from ${src} to ${target}"
17

18
pushd $src
19
git checkout gh-pages
moto's avatar
moto committed
20
21
mkdir -p ./"${target}"
rm -rf ./"${target}"/*
22
cp -r "${src}/docs/build/html/"* ./"$target"
moto's avatar
moto committed
23
if [ "${target}" == "master" ]; then
Matti Picus's avatar
Matti Picus committed
24
25
    mkdir -p ./_static
    rm -rf ./_static/*
26
    cp -r "${src}/docs/build/html/_static/"* ./_static
27
    git add --all ./_static || true
28
fi
moto's avatar
moto committed
29
git add --all ./"${target}" || true
30
31
32
33
34
git config user.email "soumith+bot@pytorch.org"
git config user.name "pytorchbot"
# If there aren't changes, don't make a commit; push is no-op
git commit -m "auto-generating sphinx docs" || true
git push -u origin gh-pages