From a76678293fe23251f7ad266e66134bec36b9ac21 Mon Sep 17 00:00:00 2001 From: lukas Date: Thu, 27 Aug 2026 22:46:39 +0200 Subject: [PATCH] wip --- .gitea/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 5987fd3..28b92f5 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -82,13 +82,42 @@ jobs: DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} IMAGE_TAG: ${{ github.sha }} run: | + set -euo pipefail + + echo "Testing DNS..." + getent hosts "$DEPLOY_HOST" + + echo "Testing SSH port..." + timeout 10 bash -c " ~/.ssh/deploy_key chmod 600 ~/.ssh/deploy_key + + echo "Getting host key..." ssh-keyscan -p "${DEPLOY_PORT:-22}" -H "$DEPLOY_HOST" >> ~/.ssh/known_hosts - scp -i ~/.ssh/deploy_key -P "${DEPLOY_PORT:-22}" \ - docker-compose.prod.yml "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/docker-compose.yml" + echo "Testing SSH authentication..." + ssh -i ~/.ssh/deploy_key \ + -p "${DEPLOY_PORT:-22}" \ + "$DEPLOY_USER@$DEPLOY_HOST" \ + "echo 'SSH connection successful'" - ssh -i ~/.ssh/deploy_key -p "${DEPLOY_PORT:-22}" "$DEPLOY_USER@$DEPLOY_HOST" \ - "cd $DEPLOY_PATH && IMAGE_TAG=$IMAGE_TAG docker compose pull && IMAGE_TAG=$IMAGE_TAG docker compose up -d && docker image prune -f" + echo "Uploading compose file..." + scp -i ~/.ssh/deploy_key \ + -P "${DEPLOY_PORT:-22}" \ + docker-compose.prod.yml \ + "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH/docker-compose.yml" + + echo "Deploying..." + ssh -i ~/.ssh/deploy_key \ + -p "${DEPLOY_PORT:-22}" \ + "$DEPLOY_USER@$DEPLOY_HOST" \ + "cd '$DEPLOY_PATH' && \ + IMAGE_TAG='$IMAGE_TAG' docker compose pull && \ + IMAGE_TAG='$IMAGE_TAG' docker compose up -d && \ + docker image prune -f" + + echo "Deployment successful!" +