Fix SSH setup in GitHub Actions workflow

This commit is contained in:
Deploy Bot
2025-07-17 20:32:14 -04:00
parent 319f197289
commit 55ce438299

View File

@@ -34,18 +34,16 @@ jobs:
- name: Set up SSH - name: Set up SSH
run: | run: |
# Create .ssh directory
mkdir -p ~/.ssh mkdir -p ~/.ssh
ssh-keyscan -p 2222 -t rsa localhost >> ~/.ssh/known_hosts chmod 700 ~/.ssh
chmod 600 ~/.ssh/known_hosts
# Generate SSH key # Generate SSH key without passphrase
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N "" ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N "" -C "github-actions@dokku-test"
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/*
# Configure SSH # Add to SSH agent
eval "$(ssh-agent -s)" eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa ssh-add ~/.ssh/id_ed25519
# Create SSH config # Create SSH config
cat > ~/.ssh/config << 'EOL' cat > ~/.ssh/config << 'EOL'
@@ -55,9 +53,27 @@ jobs:
User root User root
StrictHostKeyChecking no StrictHostKeyChecking no
UserKnownHostsFile /dev/null UserKnownHostsFile /dev/null
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_ed25519
IdentitiesOnly yes
EOL EOL
# Set permissions
chmod 600 ~/.ssh/config
chmod 600 ~/.ssh/id_ed25519*
# Add public key to Dokku container
echo "Waiting for Dokku SSH to be ready..."
until nc -z localhost 2222; do sleep 1; done
sleep 5 # Give it a moment to fully start
# Install the public key in the Dokku container
cat ~/.ssh/id_ed25519.pub | ssh-keyscan -p 2222 -t ed25519 localhost > /dev/null 2>&1 || true
cat ~/.ssh/id_ed25519.pub | ssh -p 2222 -o StrictHostKeyChecking=no root@localhost "mkdir -p /root/.ssh && cat >> /root/.ssh/authorized_keys && chmod 600 /root/.ssh/authorized_keys" || true
# Test SSH connection
echo "Testing SSH connection..."
ssh -T dokku-test "echo 'SSH connection successful!'" || echo "SSH test failed, but continuing..."
- name: Install Dokku plugins - name: Install Dokku plugins
run: | run: |
ssh -T dokku-test "\ ssh -T dokku-test "\