-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·45 lines (38 loc) · 1.15 KB
/
release.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
#!/bin/sh
deploy()
{
local command="$5"
local host="$3"
local out=$(mktemp)
local repo="$1"
local source="$2"
local status
local target="$4"
(
cd "$repo" &&
git fetch -aq &&
git diff --quiet HEAD origin/master ||
(
git reset -q --hard origin/master &&
cd "$from_root" &&
( test '!' -f setup.sh || sh setup.sh > /dev/null ) &&
tar cCO "$source" . |
ssh -q "$host" "tar xC '$target' -f - && ${command:-true}"
)
) > "$out" 2>&1
if [ "$?" -ne 0 ]; then
mail -r [email protected] -s "The FOAB is broken! ($repo)" [email protected] < "$out"
fi
rm "$out"
status=$(cd "$repo" && git log -1 --oneline)
echo "$repo: $status"
}
# deploy <repo> <src> <host> <target> <command>
(
deploy api src [email protected] /var/www/io.bidtorrent.api &&
deploy bidder-criteo src [email protected] /var/www/io.bidtorrent.test &&
deploy client-js build [email protected] /var/www/io.bidtorrent &&
deploy configuration-ui bin [email protected] /var/www/io.bidtorrent.www &&
deploy server nginx [email protected] /etc/nginx 'service nginx reload'
) |
ssh -q www-data@sandstone 'cat > www/io.bidtorrent.doc/foab.txt'