lubitest/actions/rsync/entrypoint.sh
lubiana e5584dd778
Some checks failed
/ debug (push) Failing after 36s
test
2024-12-12 20:20:48 +01:00

17 lines
552 B
Bash

#!/bin/sh -l
mkdir -p ~/.ssh/
# Print the SSH key, replacing newline characters with actual new lines
echo "$INPUT_REMOTE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
# Set appropriate permissions for the SSH key
chmod 600 ~/.ssh/id_rsa
# Add the remote host's key to the known_hosts file to avoid authenticity confirmation
ssh-keyscan -H ${INPUT_REMOTE_HOST} >> ~/.ssh/known_hosts
# SCP files to the remote host
sh -c "rsync ${INPUT_RSYNC_PARAMETERS} ${INPUT_PATH} ${INPUT_REMOTE_USER}@${INPUT_REMOTE_HOST}:${INPUT_REMOTE_PATH}"
exit 0