check for ssh key

This commit is contained in:
Maximilian Keßler 2023-10-17 16:04:55 +02:00
parent c97551b0ee
commit 37da2de5a1
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -6,7 +6,10 @@ SSH_KEY_FILE=/tmp/gitea-pages-ssh-key-$(date +%s)
echo "${INPUT_SSH_KEY}" >> "${SSH_KEY_FILE}" echo "${INPUT_SSH_KEY}" >> "${SSH_KEY_FILE}"
chmod 600 "${SSH_KEY_FILE}" chmod 600 "${SSH_KEY_FILE}"
cat "${SSH_KEY_FILE}" if [ ! -s "${SSH_KEY_FILE}" ]; then
echo "Missing ssh key, aborting deploy."
exit 1
fi
# set up ssh remote key # set up ssh remote key
echo "${INPUT_HOST} ${INPUT_HOST_KEY}" >> ~/.ssh/known_hosts echo "${INPUT_HOST} ${INPUT_HOST_KEY}" >> ~/.ssh/known_hosts
@ -14,6 +17,7 @@ echo "${INPUT_HOST} ${INPUT_HOST_KEY}" >> ~/.ssh/known_hosts
# check if directory present # check if directory present
if [ ! -d "${INPUT_DIRECTORY}" ]; then if [ ! -d "${INPUT_DIRECTORY}" ]; then
echo "Directory ${INPUT_DIRECTORY} does not exist, aborting deploy." echo "Directory ${INPUT_DIRECTORY} does not exist, aborting deploy."
exit 1
fi fi
# optionally: create index # optionally: create index