Last active
December 11, 2021 08:25
-
-
Save mandemeskel/7d4908484526cd2c8b6ee4cbbb1b69e5 to your computer and use it in GitHub Desktop.
Deploy an app build to a remote server with SSH and SCP.
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
#!/bin/sh | |
echo "deploying..." | |
# bundle, minify, and package css and js - optional | |
# gulp build | |
# using SSH vs SFTP because SSH offers us rm -rf * | |
# which deletes directories even if they are empty | |
# we don't have to traverse the directory and delete files manually | |
# <<EOF tells shell to give the following lines to the sftp terminal | |
ssh -i ~/.ssh/DEPLOY_KEY USERNAME@APP.COM <<EOF | |
cd build | |
rm -rf * | |
exit | |
EOF | |
# upload files from build to the remote file build | |
scp -r -i ~/.ssh/DEPLOY_KEY ./build/* USERNAME@APP.COM:/build/ | |
echo "deploy finished" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment