]> git.proxmox.com Git - ceph.git/blame - 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
CommitLineData
7c673cae
FG
1#!/bin/bash
2set -e # Exit with nonzero exit code if anything fails
3
4SOURCE_BRANCH="master"
5TARGET_BRANCH="gh-pages"
6
7# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
8if [ "$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
14fi
15
16if [ -z "$GH_TOKEN" ]; then
17 echo "Error: GH_TOKEN is undefined"
18 exit 1
19fi
20
21# Save some useful information
22REPO=`git config remote.origin.url`
23SHA=`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.
28cd bin.SCons
29git init
30git config user.name "Travis CI"
31git config user.email "travis-ci"
32
33# Make sure 'GH_TOKEN' is set (as 'secure' variable) in .travis.yml
34git remote add upstream "https://$GH_TOKEN@github.com/boostorg/python.git"
35git fetch upstream
36git reset upstream/gh-pages
37
38# Prepare version.
39if [ "$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
47else
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
53fi
54# Commit the new version.
55git commit -m "Deploy to GitHub Pages: ${SHA}"
56
57# Now that we're all set up, we can push.
58git push -q upstream HEAD:gh-pages