6464 sanitized_target="${user_prefix}${host_only}${port_suffix}"
6565 echo "target=$sanitized_target" >> "$GITHUB_OUTPUT"
6666
67+ - name : Configure SSH known hosts
68+ shell : bash
69+ run : |
70+ mkdir -p "$HOME/.ssh"
71+ touch "$HOME/.ssh/tailscale_known_hosts"
72+ chmod 600 "$HOME/.ssh/tailscale_known_hosts"
73+ echo "TAILSCALE_KNOWN_HOSTS=$HOME/.ssh/tailscale_known_hosts" >> "$GITHUB_ENV"
74+
6775 - name : Validate deployment secrets
6876 run : |
6977 if [ -z "${{ steps.prepare.outputs.target }}" ]; then
@@ -78,16 +86,25 @@ jobs:
7886 - name : Test Tailscale connectivity
7987 run : |
8088 echo "Testing connection to target host..."
81- tailscale ssh "${{ steps.prepare.outputs.target }}" "echo 'Connected successfully' && whoami"
89+ tailscale ssh "${{ steps.prepare.outputs.target }}" \
90+ -o StrictHostKeyChecking=accept-new \
91+ -o UserKnownHostsFile="$TAILSCALE_KNOWN_HOSTS" \
92+ "echo 'Connected successfully' && whoami"
8293
8394 - name : Deploy through Tailscale SSH
8495 run : |
8596 echo "🚀 Starting deployment..."
86- tailscale ssh "${{ steps.prepare.outputs.target }}" "${TAILSCALE_DEPLOY_COMMAND}"
97+ tailscale ssh "${{ steps.prepare.outputs.target }}" \
98+ -o StrictHostKeyChecking=accept-new \
99+ -o UserKnownHostsFile="$TAILSCALE_KNOWN_HOSTS" \
100+ "${TAILSCALE_DEPLOY_COMMAND}"
87101 echo "✅ Deployment completed"
88102
89103 - name : Post-deployment verification (optional)
90104 if : success()
91105 run : |
92106 echo "Verifying deployment..."
93- tailscale ssh "${{ steps.prepare.outputs.target }}" "systemctl status your-app || echo 'Status command not available'"
107+ tailscale ssh "${{ steps.prepare.outputs.target }}" \
108+ -o StrictHostKeyChecking=accept-new \
109+ -o UserKnownHostsFile="$TAILSCALE_KNOWN_HOSTS" \
110+ "systemctl status your-app || echo 'Status command not available'"
0 commit comments