-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·49 lines (36 loc) · 1.15 KB
/
build.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
#!/bin/sh
if ! type "yarn" > /dev/null; then
echo "\e[41m INSTALL yarn \e[0m"
exit
fi
if ! type "jq" > /dev/null; then
echo "\e[41m INSTALL jq \e[0m"
exit
fi
echo "--------------------------------"
echo "\e[33m REMOVING dist... \e[0m"
find . -name 'dist' -maxdepth 1 -type d -exec rm -rf '{}' +
echo "\e[32m dist REMOVED! \e[0m"
echo "--------------------------------"
echo "\e[33m INSTALLING DEPENDECIES... \e[0m"
yarn
echo "\e[32m DEPENDECIES INSTALLED! \e[0m"
echo "--------------------------------"
echo "\e[33m BUILD APLICATION... \e[0m"
yarn build
echo "\e[32m BUILD SUCCESS! \e[0m"
echo "--------------------------------"
if [ ! -d "dist" ]; then
echo "\e[33m CREATING DIST PASTE... \e[0m"
mkdir dist
fi
VERSION=$(jq -r '.version' package.json)
DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
jq -n --arg version $VERSION --arg dateValue $DATE '{"version" : $version , "created_at" : $dateValue}' > dist/version.json
if type "pm2" > /dev/null; then
echo "\e[33m RESTARTING SERVER... \e[0m"
pm2 restart notifier-container-docker
echo "\e[32m SERVER RESTARTED! \e[0m"
echo "--------------------------------"
fi
echo "\e[32m --> BUILD FINISH <-- \e[0m"