forked from greenelab/deep-review
-
Notifications
You must be signed in to change notification settings - Fork 3
/
deploy.sh
76 lines (61 loc) · 1.96 KB
/
deploy.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Exit on errors
set -o errexit
# Add commit hash to the README
export OWNER_NAME=`dirname $TRAVIS_REPO_SLUG`
export REPO_NAME=`basename $TRAVIS_REPO_SLUG`
envsubst < webpage/README.md > webpage/README-complete.md
mv webpage/README-complete.md webpage/README.md
# Configure git
git config --global push.default simple
git config --global user.email `git log --max-count=1 --format='%ae'`
git config --global user.name "`git log --max-count=1 --format='%an'`"
git checkout $TRAVIS_BRANCH
git remote set-url origin [email protected]:$TRAVIS_REPO_SLUG.git
# Decrypt and add SSH key
openssl aes-256-cbc \
-K $encrypted_0dd7e5f24ac8_key \
-iv $encrypted_0dd7e5f24ac8_iv \
-in ci/deploy.key.enc \
-out ci/deploy.key -d
eval `ssh-agent -s`
chmod 600 ci/deploy.key
ssh-add ci/deploy.key
# Fetch and create gh-pages and output branches
# Travis does a shallow and single branch git clone
git remote set-branches --add origin gh-pages output
git fetch origin gh-pages:gh-pages output:output
# Configure versioned webpage
python build/webpage.py \
--checkout=gh-pages \
--version=$TRAVIS_COMMIT
# Generate OpenTimestamps
ots stamp \
webpage/v/$TRAVIS_COMMIT/index.html \
webpage/v/$TRAVIS_COMMIT/manuscript.pdf
# Commit message
MESSAGE="\
`git log --max-count=1 --format='%s'`
This build is based on
https://github.com/$TRAVIS_REPO_SLUG/commit/$TRAVIS_COMMIT.
This commit was created by the following Travis CI build and job:
https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID
https://travis-ci.org/$TRAVIS_REPO_SLUG/jobs/$TRAVIS_JOB_ID
[ci skip]
The full commit message that triggered this build is copied below:
$TRAVIS_COMMIT_MESSAGE
"
# Deploy the manubot outputs to output
ghp-import \
--push \
--branch=output \
--message="$MESSAGE" \
output
# Deploy the webpage directory to gh-pages
ghp-import \
--follow-links \
--push \
--branch=gh-pages \
--message="$MESSAGE" \
webpage
# Workaround https://github.com/travis-ci/travis-ci/issues/8082
ssh-agent -k