-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·71 lines (56 loc) · 1.76 KB
/
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
confirm () {
read -r -p "${1:-Are you sure? [y/N]} " response
case $response in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
printf "${RED}You're about to deploy!${NC}\n"
confirm "Surely you can't be serious? [y/N]" || exit 1;
printf "Running dev build...\n"
brunch b || { printf "${RED}dev build failed :(${NC}\n" ; exit 1; }
printf "${GREEN}done${NC}\n"
printf "Running tests...\n"
npm run test-single || { printf "${RED}test failed :(${NC}\n" ; exit 1; }
printf "${GREEN}done${NC}\n"
printf "Running prod build...\n"
brunch b -p || { printf "${RED}build failed :(${NC}\n"; exit 1; }
printf "${GREEN}done${NC}\n"
confirm "Move files and commit to gh-pages? [y/N]" && (
printf "creating temp directory..."
mkdir ../orodarius-public
printf " ${GREEN}done${NC}\n"
printf "moving built files to temp directory..."
cp -r public/* ../orodarius-public/
printf " ${GREEN}done${NC}\n"
printf "cheking out gh-pages..."
git checkout gh-pages || { printf "${RED}can't checkout to gh-pages, make sure working directory is clean!\n"; exit 1; }
printf " ${GREEN}done${NC}\n"
printf "moving built files from temp directory..."
cp -r ../orodarius-public/* .
printf " ${GREEN}done${NC}\n"
printf "committing updates..."
git add .
git commit -m "updated release"
printf " ${GREEN}done${NC}\n"
confirm "Do you want to push to github? [y/N]" && (
printf "pushing to origin..."
git push origin gh-pages
printf "${GREEN}done${NC}\n"
)
)
printf "checking out master..."
git checkout master
printf " ${GREEN}done${NC}\n"
printf "removing temp directory..."
rm -rf ../orodarius-public
printf " ${GREEN}done${NC}\n"
printf "${GREEN}Finished!${NC}\n"