forked from SWIT2017/swit2017.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.travis_build_pages
More file actions
executable file
·26 lines (22 loc) · 856 Bytes
/
.travis_build_pages
File metadata and controls
executable file
·26 lines (22 loc) · 856 Bytes
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
#!/bin/bash
# Build the site only from the main repository's develop branch
REPO_NAME="SWIT2017/swit2017.github.io"
if [ "$TRAVIS_REPO_SLUG" != "$REPO_NAME" ] || [ "$TRAVIS_BRANCH" != "develop" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit; fi
echo -e "Generating GitHub pages...\n"
# Checkout the master branch
REPO_PATH=$PWD
pushd $HOME
git clone --quiet --branch=master https://${GH_TOKEN}@github.com/$REPO_NAME gh-pages 2>&1 > /dev/null
cd gh-pages
# Don't update if already at the latest version
if [[ `git log -1 --pretty=%B` == *$TRAVIS_COMMIT* ]]; then exit; fi
# Update pages
rm -r * 2> /dev/null
cp -r $REPO_PATH/output/* .
# Commit and push latest version
git add .
git config user.name "Travis"
git config user.email "travis@travis-ci.org"
git commit -m "Update to $TRAVIS_COMMIT."
git push -fq origin master 2>&1 > /dev/null
popd