forked from gitter-badger/actionfps
-
Notifications
You must be signed in to change notification settings - Fork 1
/
push.sh
executable file
·41 lines (35 loc) · 971 Bytes
/
push.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
#!/bin/bash
push() {
git rev-parse --verify HEAD
SHA=$(git rev-parse --verify HEAD)
git pull origin refs/heads/master
SHA=$SHA deploy
}
changed_files() { \
git diff --name-only "$SHA" "master" \
| grep -v -E '\.md' \
| grep -v 'web/dist/www'
}
deploy() {
echo Changed files from "$SHA" to master:
changed_files
if [[ $(changed_files) == "" ]]; then
deploy_content;
else
deploy_app;
fi
}
deploy_content() {
rsync --filter 'protect /home/af/web-5.0/www/assets/bower_components/' \
--delete -av ./web/dist/www/. /home/af/web-5.0/www/.
cd /home/af/web-5.0/www/assets/ && bower -f install
}
deploy_app() {
sbt web/dist
cd /home/af/ && rm -fr /home/af/web-5.0/{conf,lib,www,bin} && \
unzip -q -o /home/af/ActionFPS/web/target/universal/web-5.0.zip
sudo systemctl restart af-web
cd /home/af/web-5.0/www/assets/ && bower -f install
}
git fetch
if [[ $(git diff --name-only HEAD origin/master) != "" ]]; then push; fi