diff --git a/.gitea/workflows/ci-prod.yml b/.gitea/workflows/ci-prod.yml index 20ea5cd..7429d6f 100644 --- a/.gitea/workflows/ci-prod.yml +++ b/.gitea/workflows/ci-prod.yml @@ -128,6 +128,7 @@ jobs: docker run --rm --net=host \ -v "$(pwd):/workspace" -w /workspace \ + -v "/home/ubuntu/.ssh:/home/ubuntu/.ssh:ro" \ -v "${HOME}/.ssh:/root/.ssh:ro" \ -e TARGET_HOST="${TARGET_HOST}" \ -e TARGET_USER="${TARGET_USER}" \ @@ -136,13 +137,11 @@ jobs: alpine:latest sh -c ' apk add --no-cache openssh-client rsync && \ KEY_ARG="" && \ - if [ -f /root/.ssh/gitea_ci_key ]; then \ - KEY_ARG="-i /root/.ssh/gitea_ci_key -o IdentitiesOnly=yes" ; \ - elif [ -f /root/.ssh/id_ed25519 ]; then \ - KEY_ARG="-i /root/.ssh/id_ed25519 -o IdentitiesOnly=yes" ; \ - elif [ -f /root/.ssh/id_rsa ]; then \ - KEY_ARG="-i /root/.ssh/id_rsa -o IdentitiesOnly=yes" ; \ - fi && \ + for k in /home/ubuntu/.ssh/gitea_ci_key /root/.ssh/gitea_ci_key /home/ubuntu/.ssh/id_ed25519 /root/.ssh/id_ed25519 /home/ubuntu/.ssh/id_rsa /root/.ssh/id_rsa; do \ + if [ -f "$k" ]; then \ + KEY_ARG="-i $k -o IdentitiesOnly=yes" && break ; \ + fi ; \ + done && \ SSH_CMD="ssh -p ${PORT} ${KEY_ARG} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=15" && \ echo "Deploying backup script and .env to DB Server (${TARGET_USER}@${TARGET_HOST}:${DEST_DIR})..." && \ $SSH_CMD "${TARGET_USER}@${TARGET_HOST}" "mkdir -p ${DEST_DIR}/scripts" && \