Skip to content

Commit b877b98

Browse files
committed
Automate documentation updates.
1 parent 94dfa4c commit b877b98

File tree

2 files changed

+59
-9
lines changed

2 files changed

+59
-9
lines changed

.ci/upload_docs.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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" ] || [ "$TRAVIS_BRANCH" != master -a "$TRAVIS_BRANCH" != develop ]; then
9+
echo "No docs to upload."
10+
exit 0
11+
fi
12+
13+
# Save some useful information
14+
REPO=`git config remote.origin.url`
15+
SHA=`git rev-parse --verify HEAD`
16+
17+
# bin.SCons happens to contain the "doc/html" tree that we want to push
18+
# into the gh-pages branch. So we step into that directory, create a new repo,
19+
# set the remote appropriately, then commit and push.
20+
cd bin.SCons
21+
git init
22+
git config user.name "Travis CI"
23+
git config user.email "$COMMIT_AUTHOR_EMAIL"
24+
25+
# Make sure 'GH_TOKEN' is set (as 'secure' variable) in .travis.yml
26+
git remote add upstream "https://$GH_TOKEN@github.com/boostorg/python.git"
27+
git fetch upstream
28+
git reset upstream/gh-pages
29+
30+
# Commit the new version.
31+
cp ../index.html .
32+
cp ../doc/index.html doc/
33+
git add index.html
34+
git add doc/index.html
35+
git add -A doc/html
36+
git commit -m "Deploy to GitHub Pages: ${SHA}"
37+
38+
# Now that we're all set up, we can push.
39+
git push -q upstream HEAD:gh-pages

.travis.yml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- python -*-
21
#
32
# Copyright (c) 2016 Stefan Seefeld
43
# All rights reserved.
@@ -7,18 +6,24 @@
76
# (See accompanying file LICENSE_1_0.txt or copy at
87
# http://www.boost.org/LICENSE_1_0.txt)
98

9+
sudo: required
10+
dist: trusty
11+
1012
language: cpp
1113

1214
env:
13-
- PYTHON=python CCFLAGS=-std=c++98
14-
- PYTHON=python CCFLAGS=-std=c++11
15-
- PYTHON=python3 CCFLAGS=-std=c++98
16-
- PYTHON=python3 CCFLAGS=-std=c++11
15+
matrix:
16+
- PYTHON=python CCFLAGS=-std=c++98
17+
- PYTHON=python CCFLAGS=-std=c++11
18+
- PYTHON=python3 CCFLAGS=-std=c++98
19+
- PYTHON=python3 CCFLAGS=-std=c++11
20+
- PYTHON=python DOC=1
21+
global:
22+
- secure: mqoxglbUN/At/r8O7nLVccGldnB1jvhLHNyYjfCXrdOD0GNX+TY2TS1+kIEv9Deg/P6X/QvrBa/ZzbDNryn3mDXBfOSy400ebSIUHHP3HtGHJShOGDyXedY3hZ/dqmxdV3p9hIxv4lcx1HPyC96s4wpiR0S9F1JBzD6scIabezM=
1723

1824
compiler:
1925
- gcc
2026

21-
2227
addons:
2328
apt:
2429
sources:
@@ -30,12 +35,18 @@ addons:
3035
- python-dev python-pip
3136
- python3-dev
3237
- libboost-all-dev
33-
38+
- xsltproc
39+
- python-docutils
40+
3441
before_install:
35-
- sudo pip install future
42+
- sudo pip install future
3643

3744
install:
3845
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi
3946

40-
script: scons config --python=$PYTHON && scons && scons test
47+
script:
48+
- scons config --python=$PYTHON
49+
- if [ "$DOC" ]; then scons doc; else scons && scons test; fi
4150

51+
after_success:
52+
- if [ "$DOC" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then .ci/upload_docs.sh; fi

0 commit comments

Comments
 (0)