actions-rsync-deployment/entrypoint.sh

18 lines
552 B
Bash
Raw Permalink Normal View History

2024-12-12 01:25:31 +00:00
#!/bin/sh -l
2024-12-12 01:16:30 +00:00
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
2024-12-12 01:25:31 +00:00
ssh-keyscan -H ${INPUT_REMOTE_HOST} >> ~/.ssh/known_hosts
2024-12-12 01:16:30 +00:00
# SCP files to the remote host
2024-12-12 03:17:28 +00:00
sh -c "rsync ${INPUT_RSYNC_PARAMETERS} ${INPUT_PATH} ${INPUT_REMOTE_USER}@${INPUT_REMOTE_HOST}:${INPUT_REMOTE_PATH}"
2024-12-12 01:16:30 +00:00
exit 0