diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 41454ec3..304af3ff 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -141,13 +141,8 @@ jobs: echo "📡 Connecting to server and executing deployment commands..." echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" - # Execute remote commands with error handling and logging using bash -s - ssh -o StrictHostKeyChecking=accept-new \ - -o ServerAliveInterval=30 \ - -o ServerAliveCountMax=3 \ - -o ConnectTimeout=10 \ - -v \ - deploy@alpha.mintel.me bash -s << 'ENDSSH' + # Create deployment script + cat > /tmp/deploy.sh << 'DEPLOYEOF' set -ex echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━' echo '📡 Remote Deployment Started' @@ -155,7 +150,7 @@ jobs: echo '' echo '🔐 Logging into registry on remote server...' - echo '${{ secrets.REGISTRY_PASS }}' | docker login registry.infra.mintel.me -u '${{ secrets.REGISTRY_USER }}' --password-stdin + echo 'REGISTRY_PASS_PLACEHOLDER' | docker login registry.infra.mintel.me -u 'REGISTRY_USER_PLACEHOLDER' --password-stdin echo '✅ Remote registry login completed' echo '' @@ -186,7 +181,18 @@ jobs: echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━' echo '✅ Remote Deployment Completed Successfully' echo '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━' - ENDSSH + DEPLOYEOF + + # Replace placeholders with actual secrets + sed -i "s/REGISTRY_USER_PLACEHOLDER/${{ secrets.REGISTRY_USER }}/g" /tmp/deploy.sh + sed -i "s/REGISTRY_PASS_PLACEHOLDER/${{ secrets.REGISTRY_PASS }}/g" /tmp/deploy.sh + + # Execute remote commands + ssh -o StrictHostKeyChecking=accept-new \ + -o ServerAliveInterval=30 \ + -o ServerAliveCountMax=3 \ + -o ConnectTimeout=10 \ + deploy@alpha.mintel.me 'bash -s' < /tmp/deploy.sh DEPLOY_EXIT_CODE=$? echo ""