690419:1035 feat: update CI/CD to use SSH key authentication
CI / CD Pipeline / build (push) Successful in 8m22s
CI / CD Pipeline / deploy (push) Failing after 31s

This commit is contained in:
2026-04-19 10:35:23 +07:00
parent d422b040d9
commit feb1319fb3
4 changed files with 327 additions and 0 deletions
+15
View File
@@ -79,6 +79,11 @@ jobs:
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -p ${{ secrets.PORT }} ${{ secrets.HOST }} >> ~/.ssh/known_hosts
# Debug: Check SSH key
echo "SSH key file exists: $(test -f ~/.ssh/id_rsa && echo 'YES' || echo 'NO')"
echo "SSH key permissions: $(ls -la ~/.ssh/id_rsa)"
echo "SSH key first line: $(head -1 ~/.ssh/id_rsa)"
# Create remote deployment script
REMOTE_SCRIPT=$(cat << 'SCRIPT_EOF'
set -e
@@ -131,6 +136,16 @@ jobs:
while [ $attempt -le $max_attempts ]; do
echo " Deployment attempt $attempt/$max_attempts..."
# Debug: Test SSH connection first
echo "Testing SSH connection..."
ssh -o StrictHostKeyChecking=no \
-o ConnectTimeout=10 \
-o BatchMode=yes \
-o PasswordAuthentication=no \
-o LogLevel=DEBUG3 \
-i ~/.ssh/id_rsa \
-p ${{ secrets.PORT }} ${{ secrets.USERNAME }}@${{ secrets.HOST }} 'echo "SSH auth successful"'
if echo "$REMOTE_SCRIPT" | ssh -o StrictHostKeyChecking=no \
-o ConnectTimeout=60 \
-o ServerAliveInterval=30 \