]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/python/.ci/upload_docs.sh
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / python / .ci / upload_docs.sh
1 #!/bin/bash
2 set -e # Exit with nonzero exit code if anything fails
3
4 SOURCE_BRANCH="master"
5 TARGET_BRANCH="gh-pages"
6
7 # Pull requests and commits to other branches shouldn't try to deploy, just build to verify
8 if [ "$TRAVIS_PULL_REQUEST" != "false" ] || \
9 [ "$TRAVIS_BRANCH" != master -a \
10 "$TRAVIS_BRANCH" != develop -a \
11 "$TRAVIS_BRANCH" != travis ]; then
12 echo "No docs to upload."
13 exit 0
14 fi
15
16 if [ -z "$GH_TOKEN" ]; then
17 echo "Error: GH_TOKEN is undefined"
18 exit 1
19 fi
20
21 # Save some useful information
22 REPO=`git config remote.origin.url`
23 SHA=`git rev-parse --verify HEAD`
24
25 # bin.SCons happens to contain the "doc/html" tree that we want to push
26 # into the gh-pages branch. So we step into that directory, create a new repo,
27 # set the remote appropriately, then commit and push.
28 cd bin.SCons
29 git init
30 git config user.name "Travis CI"
31 git config user.email "travis-ci"
32
33 # Make sure 'GH_TOKEN' is set (as 'secure' variable) in .travis.yml
34 git remote add upstream "https://$GH_TOKEN@github.com/boostorg/python.git"
35 git fetch upstream
36 git reset upstream/gh-pages
37
38 # Prepare version.
39 if [ "$TRAVIS_BRANCH" = develop -o "$TRAVIS_BRANCH" = travis ]; then
40 mkdir -p develop/doc/
41 cp ../index.html develop/
42 cp ../doc/index.html develop/doc/
43 cp -a doc/html develop/doc/
44 git add develop/index.html
45 git add develop/doc/index.html
46 git add -A develop/doc/html
47 else
48 cp ../index.html .
49 cp ../doc/index.html doc/
50 git add index.html
51 git add doc/index.html
52 git add -A doc/html
53 fi
54 # Commit the new version.
55 git commit -m "Deploy to GitHub Pages: ${SHA}"
56
57 # Now that we're all set up, we can push.
58 git push -q upstream HEAD:gh-pages