rsync/rsync-docker.sh
L3D 250e6de8a4
All checks were successful
hadolint Dockerfile / build (push) Successful in 7s
shellchecking ansible-docker.sh / build (push) Successful in 14s
Improve shellcheck
2023-05-11 23:35:20 +02:00

35 lines
1,009 B
Bash
Executable file

#! /usr/bin/env bash
set -Eeuo pipefail
set -x
# Generates client.
# env:
# SOURCE: ${{ inputs.source }}
# DESTINATION: ${{ inputs.destionation }}
# HOST: ${{ inputs.host }}
# USER: ${{ inputs.user }}
# SSHKEY: ${{ inputs.sshkey }}
rsync::ssh() {
: "${SSHKEY?Please provide a SSH Private Key (ED25519).}"
: "${GITHUB_WORKSPACE?GITHUB_WORKSPACE has to be set. Did you use the actions/checkout action?}"
pushd "${GITHUB_WORKSPACE}"
mkdir ~/.ssh
chmod 700 ~/.ssh
echo "${SSHKEY}" | tee ~/.ssh/id_ed25519 > /dev/null
chmod 400 ~/.ssh/id_ed25519
# eval $(keychain --eval --quiet id_ed25519)
}
rsync::transfer() {
: "${GITHUB_WORKSPACE?GITHUB_WORKSPACE has to be set. Did you use the actions/checkout action?}"
: "${SOURCE?Define File to copy.}"
: "${DESTINATION?Define File destination.}"
: "${HOSTS?Destination Server}"
: "${USER?Destination User}"
pushd "${GITHUB_WORKSPACE}"
rsync --progress "${SOURCE}" "${USER}@${HOSTS}:${DESTINATION}"
}
rsync::ssh