-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·31 lines (24 loc) · 969 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
#!/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 ../carlov20.github.io.master
#clone `master' branch of the repository using encrypted GH_TOKEN for authentification
git clone https://${GH_TOKEN}@github.com/carlov20/carlov20.github.io.git ../carlov20.github.io.master
# copy generated HTML site to `master' branch
cp -R _site/* ../carlov20.github.io.master
# commit and push generated content to `master' branch
# since repository was cloned in write mode with token auth - we can push there
cd ../carlov20.github.io.master
git config user.email "carlo.a.veo@gmail.com"
git config user.name "Carlo Veo"
git add -A .
git commit -a -m "Travis #$TRAVIS_BUILD_NUMBER"
git push --quiet origin master > /dev/null 2>&1