commit_docs.sh 801 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env bash

set -ex


if [ "$2" == "" ]; then
    echo call as $0 "<src>" "<target branch>"
    echo where src is the built documentation and
    echo branch should be "master" or "1.7" or so
    exit 1
fi

13
src=$1
14
15
16
target=$2

set -ex
17
echo "committing docs from ${src} to ${target}"
18
19

git checkout gh-pages
Matti Picus's avatar
Matti Picus committed
20
21
22
mkdir -p ./$target
rm -rf ./$target/*
cp -r ${src}/build/html/* ./$target
23
if [ "$target" == "master" ]; then
Matti Picus's avatar
Matti Picus committed
24
25
26
27
    mkdir -p ./_static
    rm -rf ./_static/*
    cp -r ${src}/build/html/_static/* ./_static
    git add ./_static || true
28
fi
Matti Picus's avatar
Matti Picus committed
29
git add ./$target || true
30
31
32
33
34
35
36
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