-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathdeploy.sh
executable file
·44 lines (36 loc) · 908 Bytes
/
deploy.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
#!/bin/bash
SELF=`echo $0 | sed 's/\\\\/\\//g'`
cd "`dirname "$SELF"`" || exit 1
set -e
#### Prerequisites
#
# 1. Make sure you have another clone of this repo called 'gh-pages',
# located in this folder.
#
# 2. Make sure this clone has the 'gh-pages' branch checked out.
#
# 3. Make sure your working tree is clean and up-to-date.
#
SRC="_site"
DST="gh-pages"
if [[ "$OSTYPE" = msys* ]]; then
# We don't process images properly on Windows :(
>&2 echo "fatal: Not supported on Windows"
exit 1
fi
if [ ! -d "$DST"/.git ]; then
>&2 echo "fatal: Destination '$DST' is not a Git repository"
exit 1
fi
# Read last commit SHA from source Git repository
SHA=`git rev-parse HEAD 2> /dev/null || :`
echo -e "Deploying $SHA\n"
bash build.sh
cp -R "$SRC"/* "$DST"
cd "$DST"
git add *
git commit -am"Deploy $SHA"
git status
git push
# Please inspect what you just pushed!
git show -1 || :