Created
November 30, 2019 17:56
-
-
Save Twoody/e8ac024c4f5f2d63e6ffdd9cf7bdbfb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deploy-live (){ | |
# Author: [email protected] | |
# Creation Date: 2019-10-12 | |
# Purpose: | |
# Deploy code to production server; | |
# This is done within a shell script as we do not have the /build/ | |
# dir git controlled and manually need to copy over files that are | |
# generated to their corresponding path; | |
# TODO: | |
# Check if dirs exist on server; Mkdir if dirs do not exist; | |
# Remove the other contents of the directory so we don't bloat our server :( | |
[email protected]:/home3/passtowc/public_html/ | |
curdir=$PWD | |
#scppath=$(echo "$curdir" | sed -e 's/^.*www\/portals\///g') | |
#scppath=$(echo "$scppath" | sed 's/\/[^\/]*$//') | |
scppath=$(echo "$curdir" | sed -e 's/^.*www\/portals\///g' -e 's/\/[^\/]*$//') | |
if [ ! -d build/ ] | |
then | |
echo -e "ERROR:\n\tDoes not appear to be correct directory;" | |
echo -e "\tDir /build/ not found;" | |
false | |
elif [ ! -d build/static/ ] | |
then | |
echo -e "ERROR:\n\tNo ./build/static/ dir found;" | |
echo -e "\tAborting;" | |
false | |
elif [ ! -f build/index.html ] | |
then | |
echo -e "ERROR:\n\tNo ./build/index.html found;" | |
echo -e "\tAborting;" | |
false | |
elif [ ! -f build/manifest.json ] | |
then | |
echo -e "ERROR:\n\tNo ./build/manifest.html found;" | |
echo -e "\tAborting;" | |
false | |
elif [ ! -f build/precache-manifest.* ] | |
then | |
echo -e "ERROR:\n\tNo ./build/manifest.json found;" | |
echo -e "\tAborting;" | |
false | |
elif [ ! -f build/robots.txt ] | |
then | |
echo -e "ERROR:\n\tNo ./build/robots.txt found;" | |
echo -e "\tAborting;" | |
false | |
elif [ ! -f build/service-worker.js ] | |
then | |
echo -e "ERROR:\n\tNo ./build/service-worker.js found;" | |
echo -e "\tAborting;" | |
false | |
elif [ ! -f build/service-worker.js ] | |
then | |
echo -e "ERROR:\n\tNo ./build/service-worker.js found;" | |
echo -e "\tAborting;" | |
false | |
elif passtow "[ ! -d /home3/passtowc/public_html/$scppath ]" | |
then | |
echo -e "\tERROR:\n\t'$scppath' DOES NOT EXIST ON REMOTE SERVER;" | |
echo -e "\tAborting;" | |
false | |
else | |
echo -e "******************************************" | |
echo -e "Going to scp stuff...\n" | |
echo "Sending to $passtowpath$scppath " | |
scp -r ./build/* $passtowpath$scppath | |
echo -e "\nEND deploy-live" | |
echo -e "******************************************" | |
true | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment