Statistics
| Branch: | Revision:

iof-tools / networkxMiCe / networkx-master / tools / travis / deploy_docs.sh @ 5cef0f13

History | View | Annotate | Download (2.04 KB)

1
#!/usr/bin/env bash
2

    
3
set -e
4

    
5
section "Deploy docs"
6
if [[ $TRAVIS_PULL_REQUEST == false && $TRAVIS_BRANCH == "master" && $BUILD_DOCS == 1 && $DEPLOY_DOCS == 1 ]]
7
then
8
    # "A deploy key is an SSH key that is stored on your server and grants access to a single GitHub repository.
9
    # This key is attached directly to the repository instead of to a personal user account."
10
    # -- https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys
11
    #
12
    # $ ssh-keygen -t ed25519 -C "Networkx Travis Bot" -f deploy-key
13
    # Your identification has been saved in deploy-key.
14
    # Your public key has been saved in deploy-key.pub.
15
    #
16
    # Add the deploy-key.pub contents to your repo's settings under Settings -> Deploy Keys.
17
    # Encrypt the private deploy-key for Travis-CI and commit it to the repo
18
    #
19
    # $ gem install travis
20
    # $ travis login
21
    # $ travis encrypt-file deploy-key
22
    # storing result as deploy-key.enc
23
    #
24
    # The ``travis encrypt-file deploy-key`` command provides the ``openssl`` command below.
25

    
26
    # Decrypt the deploy-key with the Travis-CI key
27
    openssl aes-256-cbc -K $encrypted_64abb7a9cf51_key -iv $encrypted_64abb7a9cf51_iv -in tools/travis/deploy-key.enc -out deploy-key -d
28
    chmod 600 deploy-key
29
    eval `ssh-agent -s`
30
    ssh-add deploy-key
31

    
32
    # Push the latest docs to the networkx/documentation repo (gh-pages branch)
33
    GH_REF=git@github.com:networkx/documentation.git
34
    echo "-- pushing docs --"
35
    (
36
    git config --global user.email "travis@travis-ci.com"
37
    git config --global user.name "NetworkX Travis Bot"
38

    
39
    cd doc
40
    git clone --quiet --branch=gh-pages --depth=1 ${GH_REF} ghpages_build
41
    cd ghpages_build
42

    
43
    # Overwrite previous commit
44
    git rm -r latest
45
    cp -a ../build/html latest
46
    cp -a ../build/latex/networkx_reference.pdf latest/_downloads/.
47
    git add latest
48
    git commit -m "Deploy GitHub Pages"
49

    
50
    git push --force --quiet "${GH_REF}" gh-pages > /dev/null 2>&1
51
    cd ../..
52
    )
53
else
54
    echo "-- will only push docs from master --"
55
fi
56
section_end "Deploy docs"
57

    
58
set +e