forked from json-schema-org/understanding-json-schema
-
Notifications
You must be signed in to change notification settings - Fork 0
/
travis_deploy.sh
executable file
·49 lines (38 loc) · 1.21 KB
/
travis_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
#!/bin/bash
# Stop at the first error
set -e
GH_ACCOUNT=spacetelescope
GH_EMAIL=mdboom@gmail.com
GH_REPOSITORY=understanding-json-schema
GH_REMOTE=live
GH_PAGESBRANCH=gh-pages
function error_exit
{
echo -e "\e[01;31m$1\e[00m" 1>&2
exit 1
}
if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then
git remote add $GH_REMOTE https://${GH_TOKEN}@github.com/$GH_ACCOUNT/$GH_REPOSITORY.git
git config --global user.email ${GH_EMAIL}
git config --global user.name "Michael Droettboom"
# Create a new "orphaned" branch -- we don't need history for
# the built products
git checkout --orphan $GH_PAGESBRANCH
# This will delete all of the git-managed files here, but not
# the results of the build
git rm -rf .
rm -rf texlive
rm -rf install-tl*
# Copy the built files to the root
cp -r build/html/* .
cp -r build/latex/*.pdf .
# Delete the original location of the built files
rm -rf build
# We need to tell github this is not a Jekyll document
touch .nojekyll
git add .nojekyll
git add *
git commit -m "Generated from sources"
echo "Push to gh-pages branch"
git push -f $GH_REMOTE $GH_PAGESBRANCH
fi