Skip to content

Commit e7391de

Browse files
committed
Autodeploy to gh-pages
Make site to build to staging.tarantool.org, if you'll push to branch 'staging'.
1 parent 0437844 commit e7391de

File tree

8 files changed

+87
-3
lines changed

8 files changed

+87
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ sphinx/locale/ru/LC_MESSAGES/*.mo
66
.DS_Store
77
sphinx/_html_ru_build/
88
sphinx/_single_ru_build/
9+
deploy_key

.travis.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: generic # don't install any environment
2+
install:
3+
- pip install sphinx pelican BeautifulSoup sphinx-intl PyYAML --user
4+
script: bash ./documentation.sh
5+
env:
6+
global:
7+
- ENCRYPTION_LABEL: "cc37864fc395"
8+

deploy_key.enc

3.17 KB
Binary file not shown.

documentation.sh

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

sphinx/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
master_doc = 'index'
1313

1414
extensions = [
15-
'sphinx.ext.todo',
16-
'sphinx.ext.ifconfig',
1715
'ext.custom',
1816
'ext.LuaDomain',
1917
'ext.LuaLexer',
2018
'ext.TapLexer',
2119
'ext.TarantoolSessionLexer',
20+
'sphinx.ext.todo',
21+
'sphinx.ext.ifconfig',
2222
'sphinx.ext.intersphinx',
2323
]
2424
primary_domain = 'lua'

www/content/.nojekyll

Whitespace-only changes.

www/content/CNAME

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
staging.tarantool.org

www/pelicanconf.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@
5353
'js/highcharts_base.js',
5454
'js/jquery.min.js',
5555
'terms.docx',
56-
'license.docx'
56+
'license.docx',
57+
'.nojekyll',
58+
'CNAME'
5759
]
5860

5961
EXTRA_PATH_METADATA = {}

0 commit comments

Comments
 (0)