-
Notifications
You must be signed in to change notification settings - Fork 11
/
update_prod.sh
executable file
·51 lines (36 loc) · 1.03 KB
/
update_prod.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
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
set -e
srce="master"
dest="gh-pages"
devl="develop"
self=`basename $0`
tmpl=`git log | head -n1 | cut -d" " -f2`
tmpd="/tmp/$tmpl"
echo "---> Updating gh-pages with master generated content"
ldir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $ldir
echo "---> Changing to $srce"
git checkout $srce
echo "---> Merging changes from $devl branch"
git pull; git merge -m "merging from $devl on `date`" $devl
echo "---> Building from latest master to $tmpd"
jekyll build -d $tmpd
echo "---> Changing to $dest branch"
git checkout $dest
echo "---> Syncing $dest branch with any remote changes"
git pull
echo "---> Removing existing content from $dest branch"
git rm -qr .
echo "---> Copying new content into $dest branch"
cp -r $tmpd/. .
echo "---> Cleaning up unneeded files"
rm ./$self
rm -r $tmpd
echo "---> Publishing to $dest branch"
git add -A
git commit -m "publishing updates to $dest on `date`"
git push origin $dest
echo "---> Changing back to $srce branch"
git checkout $srce
echo "---> Update complete"
exit 0