forked from ReproNim/reproschema-ui
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
36 lines (25 loc) · 1.08 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
#!/bin/bash
set -e # exit with nonzero exit code if anything fails
if [[ $TRAVIS_BRANCH == "master" && $TRAVIS_PULL_REQUEST == "false" ]]; then
echo "Starting to update gh-pages\n"
#copy data we're interested in to other place
cp -R dist $HOME/dist
#go to home and setup git
cd $HOME
git config --global user.email "[email protected]"
git config --global user.name "Travis"
#using token clone gh-pages branch
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/${GH_USER}/${GH_REPO}.git gh-pages > /dev/null
#go into directory and copy data we're interested in to that directory
cd gh-pages
cp -Rf $HOME/dist/* .
echo "Allow files with underscore https://help.github.com/articles/files-that-start-with-an-underscore-are-missing/" > .nojekyll
echo "[View live](https://${GH_USER}.github.io/${GH_REPO}/)" > README.md
#add, commit and push files
git add -f .
git commit -m "Travis build $TRAVIS_BUILD_NUMBER"
git push -fq origin gh-pages > /dev/null
echo "Done updating gh-pages\n"
else
echo "Skipped updating gh-pages, because build is not triggered from the master branch."
fi;