Skip to content

Commit c560fb9

Browse files
committed
Configuring autodeploy to Github Pages
1 parent 502e919 commit c560fb9

File tree

7 files changed

+84
-6
lines changed

7 files changed

+84
-6
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ install_manifest.txt
99
*.dylib
1010
.*.swp
1111

12+
output
1213
test/tarantool-*
1314
test/test
1415
*.xlog
@@ -22,3 +23,6 @@ valgrind.out
2223
doxygen
2324
html
2425
latex
26+
27+
id_rsa-keygen
28+
id_rsa-keygen.pub

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "third_party/msgpuck"]
22
path = third_party/msgpuck
33
url = https://github.com/tarantool/msgpuck.git
4-
[submodule "site"]
5-
path = doc/output
6-
url = https://github.com/tarantool/tarantool-c.git

.travis.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ compiler:
88
- gcc
99

1010
env:
11+
global:
12+
- ENCRYPTION_LABEL="27298b445e90"
1113
matrix:
1214
- OS=el DIST=6 PACK=rpm
1315
- OS=el DIST=7 PACK=rpm
@@ -23,6 +25,7 @@ env:
2325
- OS=debian DIST=stretch PACK=deb
2426
- OS=debian DIST=sid PACK=deb
2527
- PACK=none
28+
- PACK=documentation.sh
2629

2730
matrix:
2831
fast_finish: true
@@ -67,9 +70,11 @@ matrix:
6770
compiler: clang
6871
- env: OS=debian DIST=sid PACK=deb
6972
compiler: clang
73+
- env: PACK=documentation.sh
74+
compiler: gcc
7075

7176
script:
72-
- git clone https://github.com/tarantool/build.git
77+
- git clone https://github.com/tarantool/build.git -b extended-pack
7378
- bash build/pack/travis.sh
7479

7580
notifications:

deploy_key.enc

3.17 KB
Binary file not shown.

doc/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
find_package(Sphinx)
22

33
set(SPHINX_BUILD_HTML_DIR "${PROJECT_BINARY_DIR}/doc/_build/html")
4-
set(SPHINX_HTML_DIR "${PROJECT_BINARY_DIR}/doc/output/")
4+
set(SPHINX_HTML_DIR "${PROJECT_BINARY_DIR}/output/")
55

66
if (NOT Sphinx-NOTFOUND)
77
add_custom_target(sphinx-html

doc/output

-1
This file was deleted.

documentation.sh

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
OUTPUT_PATH="$TRAVIS_BUILD_DIR/output"
7+
COMMIT_AUTHOR_EMAIL="${COMMIT_AUTHOR_EMAIL:-build@tarantool.org}"
8+
9+
function doCompile {
10+
pip install sphinx sphinx_rtd_theme
11+
cmake .
12+
make sphinx-html
13+
}
14+
15+
# Pull requests and commits to other branches shouldn't try to deploy, just
16+
# build to verify
17+
if [ "$TRAVIS_PULL_REQUEST" != "false" -o "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]; then
18+
echo "documentation.sh: Skipping deploy; just doing a build."
19+
doCompile
20+
exit 0
21+
fi
22+
23+
# Save some useful information
24+
REPO=`git config remote.origin.url`
25+
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
26+
SHA=`git rev-parse --verify HEAD`
27+
28+
# Clone the existing gh-pages for this repo into $OUTPUT_PATH
29+
# Create a new empty branch if gh-pages doesn't exist yet (should only happen
30+
# on first deply)
31+
git clone $REPO $OUTPUT_PATH
32+
cd $OUTPUT_PATH
33+
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
34+
cd $TRAVIS_BUILD_DIR
35+
36+
# Clean out existing contents
37+
rm -rf $OUTPUT_PATH/* || exit 0
38+
39+
# Run our compile script
40+
doCompile
41+
42+
# Now let's go have some fun with the cloned repo
43+
cd $OUTPUT_PATH
44+
git config user.name "Travis CI"
45+
git config user.email "$COMMIT_AUTHOR_EMAIL"
46+
47+
# If there are no changes to the compiled out (e.g. this is a README update)
48+
# then just bail.
49+
if [ -z "`git diff --stat --exit-code`" ]; then
50+
echo "documentation.sh: No changes to the output on this push; exiting."
51+
exit 0
52+
fi
53+
54+
# Commit the "changes", i.e. the new version.
55+
# The delta will show diffs between new and old versions.
56+
git add --all .
57+
git status
58+
git commit -m "Deploy to GitHub Pages: ${SHA}"
59+
60+
# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
61+
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
62+
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
63+
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
64+
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
65+
ENCRYPTED_KEY_PATH="${TRAVIS_BUILD_DIR}/deploy_key.enc"
66+
DECRYPTED_KEY_PATH="${TRAVIS_BUILD_DIR}/deploy_key"
67+
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in "$ENCRYPTED_KEY_PATH" -out "$DECRYPTED_KEY_PATH" -d
68+
chmod 600 "$TRAVIS_BUILD_DIR/deploy_key"
69+
eval `ssh-agent -s`
70+
ssh-add "$TRAVIS_BUILD_DIR/deploy_key"
71+
72+
# Now that we're all set up, we can push.
73+
git push $SSH_REPO $TARGET_BRANCH

0 commit comments

Comments
 (0)