From 61ffdece86859ea1f33b0890be0fd9f563809436 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Sun, 6 Oct 2019 23:11:39 +0900 Subject: [PATCH] feat: Add SCRIPT_MODE --- entrypoint.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index a123dd3..4393592 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,10 +28,15 @@ if [ -n "${ACTIONS_DEPLOY_KEY}" ]; then print_info "setup with ACTIONS_DEPLOY_KEY" - mkdir "${HOME}/.ssh" - ssh-keyscan -t rsa github.com > "${HOME}/.ssh/known_hosts" - echo "${ACTIONS_DEPLOY_KEY}" > "${HOME}/.ssh/id_rsa" - chmod 400 "${HOME}/.ssh/id_rsa" + if [ -n "${SCRIPT_MODE}" ]; then + SSH_DIR="${HOME}/.ssh" + else + SSH_DIR="/root/.ssh" + fi + mkdir "${SSH_DIR}" + ssh-keyscan -t rsa github.com > "${SSH_DIR}/known_hosts" + echo "${ACTIONS_DEPLOY_KEY}" > "${SSH_DIR}/id_rsa" + chmod 400 "${SSH_DIR}/id_rsa" remote_repo="git@github.com:${PUBLISH_REPOSITORY}.git"