actions/deploy_user/entrypoint.sh

19 lines
588 B
Bash
Executable file

#!/bin/sh
export USERNAME=$1
export SSH_KEY=$2
export FOLDER=$3
export DESTINATION=$4
# jank I know
echo "$SSH_KEY" > tmp.key
chmod 600 tmp.key
# ensure teh public_html is created and has right permissions
ssh -v -i tmp.key ${USERNAME}@skynet.skynet.ie "mkdir -p ~/public_html && chmod 711 ~ || true && chmod -R 755 ~/public_html || true"
# ensure output folder exists
ssh -v -i tmp.key ${USERNAME}@skynet.skynet.ie "mkdir -p ~/public_html/${DESTINATION}"
# copy files across
scp -v -i tmp.key -r ${FOLDER}/* ${USERNAME}@skynet.skynet.ie:/home/${USERNAME}/public_html/${DESTINATION}