2019-08-03 14:03:35 -07:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Push built release files to production server
|
|
|
|
#
|
|
|
|
|
2019-12-19 21:50:50 -08:00
|
|
|
echo -e "\e[32m\nStarting Build. \n\e[0m"
|
2019-08-03 14:03:35 -07:00
|
|
|
|
|
|
|
# Build out new release
|
|
|
|
cd client
|
|
|
|
npm run build
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# only compress client/dist and server with node_modules
|
|
|
|
echo -e "\e[32m\nCompressing client and server code... \n\e[0m"
|
2019-12-19 21:50:50 -08:00
|
|
|
tar -czf release.tar.gz server node_modules client/dist staticFiles/assets
|
2019-08-03 14:03:35 -07:00
|
|
|
|
|
|
|
#send compressed release to remote machine
|
|
|
|
echo -e "\e[32m\nMoving compressed release to production... \n\e[0m"
|
|
|
|
rsync -e 'ssh -p 13328' -havzC --update release.tar.gz mab@avidhabit.com:/home/mab/pi/
|
|
|
|
|
|
|
|
# Remove Release from local after its been uploaded
|
|
|
|
rm release.tar.gz
|
|
|
|
|
|
|
|
#uncompress release on server
|
|
|
|
echo -e "\e[32m\nExtracting release on production... \n\e[0m"
|
2019-12-19 21:50:50 -08:00
|
|
|
ssh mab@avidhabit.com -p 13328 "cd /home/mab/pi/; rm -r server node_modules client; tar -xzf *.tar.gz --overwrite; rm *.tar.gz; pm2 reload all"
|
2019-08-03 14:03:35 -07:00
|
|
|
|
|
|
|
#Congratulate how awesome you are
|
|
|
|
echo -e "\e[32m\nRelease Complete! Nice Work! \n\e[0m"
|