-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy_to_ubuntu_server.yml
62 lines (52 loc) · 1.68 KB
/
deploy_to_ubuntu_server.yml
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
name: Deploy to Ubuntu server
trigger:
- master
pool:
vmImage: self-hosted
name: Ubuntu-Agent
steps:
- script: |
CURR="$(pwd)"
TRGT="/home/$USER"
APP="$TRGT/vetrodilusso"
echo 'Starting with the deployment process, '
echo 'doing the initial steps... wait..'
if [[ -d $APP && -e $APP ]]; then
echo "Info:The $APP dir exists... This will be removed"
rm -R $APP
echo "Done!. $APP directory was removed successful"
echo
fi
if [[ -e $TRGT && -w $TRGT ]]; then
echo "Info:The app dir will be moved from $CURR to $APP"
mv $CURR $APP
echo "Info:The app dir was moved from $CURR to $APP"
cd $APP
echo
else
echo "Info:The app dir will be copied from $CURR to $APP"
cp -u -r $CURR $APP
echo "Info:The app dir was copied from $CURR to $APP"
cd $APP
echo
fi
chmod -R +wrx $APP
if [[ $(pwd) != $APP ]]; then
cd $APP
fi
echo 'Success!. the last step finished with any issue... Performing the next step...'
echo
echo 'Starting compilation for development...'
echo 'Wait.. This may take several minutes...'
if [[ $(`npm install`) -eq "0" ]]; then
echo 'Done!. The app was compiled. No further errors...'
echo
echo 'Info:. finishing the deployment. '
echo "This Webapp can be found in http://$(hostname):3000 "
exit 0
else
echo 'Error:. Oh! something is getting problems.. Please inspect the logs'
echo 'and your project settings to find the issue(s) and try again';
exit 1
fi
displayName: 'Initialize development mode'