replace rsync script with scp script

This commit is contained in:
ace 2023-05-01 23:22:15 +01:00
parent e622346ff3
commit 075515ea91

View file

@ -27,8 +27,12 @@ then
# check that build directory is not empty
if [ "$(ls -A $DIR)" ]; then
# push to public web server location
# note: this will delete everything on the server that's not in the local build folder
rsync -avz --delete "$DIR"/ ${USER}@${HOST}:~/${REMOTE_DIR} && git restore --staged . && git add public && git commit -m "deployed changes to server" && echo "Changes deployed to $HOST" || echo "No changes deployed to $HOST"
# via scp - this will not delete old files
scp -r -P ${PORT} -o User=${USER} $DIR/* ${HOST}:${REMOTE_DIR}
# via rsync - this command will delete everything on the server that's not in the local build folder
# rsync -avz --delete "$DIR"/ ${USER}@${HOST}:~/${REMOTE_DIR} && git restore --staged . && git add public && git commit -m "deployed changes to server" && echo "Changes deployed to $HOST" || echo "No changes deployed to $HOST"
else
# if build fails restore the old build directory
git restore "$DIR"