test: ssh connection check
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
name: Test SSH Connection
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Test SSH
|
||||
env:
|
||||
STAGING_SSH_KEY: ${{ secrets.STAGING_SSH_KEY }}
|
||||
STAGING_HOST: ${{ secrets.STAGING_HOST }}
|
||||
STAGING_USER: ${{ secrets.STAGING_USER }}
|
||||
run: |
|
||||
echo "$STAGING_SSH_KEY" > /tmp/key_raw
|
||||
if head -1 /tmp/key_raw | grep -q "BEGIN OPENSSH"; then
|
||||
cp /tmp/key_raw /tmp/key
|
||||
else
|
||||
base64 -d /tmp/key_raw > /tmp/key
|
||||
fi
|
||||
chmod 600 /tmp/key
|
||||
echo "=== Key fingerprint ==="
|
||||
ssh-keygen -l -f /tmp/key
|
||||
echo "=== SSH Test ==="
|
||||
ssh -i /tmp/key -p 2222 -o StrictHostKeyChecking=no $STAGING_USER@$STAGING_HOST "echo SSH_OK && docker ps --format '{{.Names}}' | head -3"
|
||||
Reference in New Issue
Block a user