FTP-Deploy-Action/entrypoint.sh
Thijs Niks 2402366393 Adding quotes around username and password
Per lftp documentation
2019-11-16 19:21:15 -08:00

26 lines
675 B
Bash
Executable File

#!/bin/sh
# "to avoid continuing when errors or undefined variables are present"
set -eu
echo "Starting FTP Deploy"
WDEFAULT_LOCAL_DIR=${LOCAL_DIR:-"."}
WDEFAULT_REMOTE_DIR=${REMOTE_DIR:-"."}
WDEFAULT_ARGS=${ARGS:-""}
WDEFAULT_METHOD=${METHOD:-"ftp"}
if [ $WDEFAULT_METHOD = "sftp" ]; then
WDEFAULT_PORT=${PORT:-"22"}
else
WDEFAULT_PORT=${PORT:-"21"}
fi;
echo "Using $WDEFAULT_METHOD to connect to port $WDEFAULT_PORT"
echo "Uploading files..."
lftp $WDEFAULT_METHOD://$FTP_SERVER:$WDEFAULT_PORT -u "$FTP_USERNAME","$FTP_PASSWORD" -e "set ftp:ssl-allow no; mirror $WDEFAULT_ARGS -R $WDEFAULT_LOCAL_DIR $WDEFAULT_REMOTE_DIR; quit"
echo "FTP Deploy Complete"
exit 0