-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdeploy.sh
executable file
·61 lines (49 loc) · 1008 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# How to use
# ==========
# 1. To generate content:
# $ bash deploy.sh build
# 2. To copy the generated content to master branch:
# $ bash deploy.sh copy
function PULL() {
git checkout master
git pull bdoi master
git checkout sources
git pull bdoi sources
echo "Done! You are at master branch"
}
function PUSH() {
echo "ORIGIN: $1"
echo "BRANCH: $2"
echo "Pushing to $1 $2"
read -p "Are you sure? " yn
[ "$yn" != "y" ] && exit 127
echo "Pushing . . ."
git push $1 $2
}
function COPY() {
tar -czf /tmp/bdoi.tar.gz -C ./_site .
git stash
git checkout master
rm -rf ./*
tar -xzf /tmp/bdoi.tar.gz ./
}
function BUILD() {
git checkout sources
docker-compose up -d
sleep 30
docker-compose stop
}
if [ "$1" = "push" ]; then
PUSH origin sources
PUSH origin master
fi
if [ "$1" = "pull" ]; then
PULL
fi
if [ "$1" = "build" ]; then
BUILD
fi
if [ "$1" = "copy" ]; then
COPY
fi