-
Notifications
You must be signed in to change notification settings - Fork 28
/
pull_publish.sh
executable file
·38 lines (28 loc) · 1.01 KB
/
pull_publish.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
36
37
38
#!/bin/bash
# check whether file ~/cronenv exists and if it does, read the file and execute the commands in it
if [ -e ~/cronenv ]
then
source ~/cronenv
fi
echo "Building docs at $(date)"
# extract directory name from the filename of the current script and cd to it
cd `dirname $0`
# retrieve names of git branches and pick out the one that is starred (current branch)
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
echo "On branch ${branch}, doing git pull"
# retrieve the latest files from the current git branch
git pull
# build the docs website
echo "Building site..."
bundle exec nanoc
# don't need to copy this file over anymore
# cp -r output/prebuilt/couchbase-manual-3.0/assets-dita output/
# Hack for S3 redirects related to new Docs
mv -f output/index.html output/index_old.html
# if on master branch, publish output files to S3
if [ "${branch}" == "master" ]
then
echo "On master branch, deploying to docs.couchbase.com"
s3cmd sync -P output/ s3://docs.couchbase.com/
fi
echo "Done at $(date)"