-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·48 lines (37 loc) · 1.43 KB
/
deploy.sh
File metadata and controls
executable file
·48 lines (37 loc) · 1.43 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
set -eo pipefail
BRANCH=gh-pages
TARGET_REPO=HashDataInc/docs.git
echo -e "Testing travis-encrypt"
echo -e "$VARNAME"
if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
echo -e "Starting to deploy to Github Pages\n"
if [ "$TRAVIS" == "true" ]; then
git config --global user.email "travis@travis-ci.org"
git config --global user.name "Travis"
fi
VERSION=$TRAVIS_BRANCH
if [ "$TRAVIS_BRANCH" == "master" -o "$TRAVIS_BRANCH" == "gitbook" ]; then
VERSION=latest
fi
#using token clone gh-pages branch
git clone --quiet --branch=$BRANCH https://${GH_TOKEN}@github.com/$TARGET_REPO built_website > /dev/null
mkdir -p built_website/${VERSION}
#go into directory and copy data we're interested in to that directory
cd built_website/${VERSION}
rm -rf *
cp -r ../../_book/* .
#add, commit and push files
git add -f --all .
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to Github Pages"
git push -fq origin $BRANCH > /dev/null
if [ -n "${access_key_id}" -a -n "${access_key_secret}" ]; then
rm -rf .git
echo "access_key_id: '${access_key_id}'" >~/qsconfig
echo "secret_access_key: '${access_key_secret}'" >>~/qsconfig
qsctl rm -r -c ~/qsconfig qs://hashdata-docs/${VERSION}/
qsctl cp -r -c ~/qsconfig `pwd` qs://hashdata-docs/${VERSION}/
rm -f ~/qsconfig
fi
echo -e "Deploy completed\n"
fi