forked from linkeddata/rdflib.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis_publish
executable file
·30 lines (25 loc) · 1018 Bytes
/
.travis_publish
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
#!/bin/bash
REPO_NAME="linkeddata/rdflib.js"
PUBLICATION_BRANCH=gh-pages
# Only publish from a specific Node version
if [ "$TRAVIS_NODE_VERSION" != "$PUBLISH_FROM_NODE_VERSION" ]; then exit; fi
# Only publish from the main repository's master branch
if [ "$TRAVIS_REPO_SLUG" != "$REPO_NAME" ] || [ "$TRAVIS_BRANCH" != "master" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit; fi
echo -e "Building $PUBLICATION_BRANCH...\n"
# Checkout the branch
REPO_PATH=$PWD
pushd $HOME
git clone --quiet --depth=1 --branch=$PUBLICATION_BRANCH https://${GH_TOKEN}@github.com/$REPO_NAME publish 2>&1 > /dev/null
cd publish
# 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/dist .
# Commit and push latest version
git add .
git config user.name "Travis"
git config user.email "[email protected]"
git commit -m "Update to $TRAVIS_COMMIT."
git push -fq origin $PUBLICATION_BRANCH 2>&1 > /dev/null
popd