scp-action/entrypoint.sh
2022-04-18 13:11:00 -05:00

12 lines
490 B
Bash
Executable File

#!/bin/sh -l
if [[ "$INPUT_KEY" ]]; then
echo -e "${INPUT_KEY}" > key
chmod 400 key
echo "Trying SCP process with SSH key"
scp -P $INPUT_PORT -o StrictHostKeyChecking=no -i key $INPUT_ORIGIN "$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"
else
echo "Trying SCP process with password"
sshpass -p $INPUT_PASSWORD scp -P $INPUT_PORT -o StrictHostKeyChecking=no $INPUT_ORIGIN "$INPUT_USERNAME"@"$INPUT_HOST":"$INPUT_DESTINATION"
fi
echo "Files successfully copied"