forked from nus-oss/cs3281-AY1516S2-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·35 lines (28 loc) · 980 Bytes
/
build.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
#!/bin/bash
# only proceed script when started not by pull request (PR)
if [ $TRAVIS_PULL_REQUEST == "true" ]; then
echo "this is PR, exiting"
exit 0
fi
# enable error reporting to the console
set -e
# build site with jekyll, by default to `_site' folder
bundle exec jekyll build
# cleanup
rm -rf ../_site
# copy generated HTML site to `gh-pages' branch
mv _site ../
git clean -f
git remote set-branches --add origin gh-pages
git fetch origin gh-pages --depth=1
git checkout -t -b gh-pages remotes/origin/gh-pages
rm -rf *
cp -R ../_site/* .
# commit and push generated content to `gh-pages' branch
# add remote with token to push with
git remote add deploy https://${GH_TOKEN}@github.com/nus-oss/cs3281.git > /dev/null 2>&1
git config user.email "[email protected]"
git config user.name "NUS OSS Bot"
git add -A .
git commit -a -m "Built $TRAVIS_COMMIT (Travis build $TRAVIS_BUILD_NUMBER)"
git push --quiet deploy gh-pages:gh-pages > /dev/null 2>&1