-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
38 lines (36 loc) · 1.05 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: 'WP Engine SSH Setup'
description: 'Configures an SSH connection'
inputs:
ssh_user:
description: 'SSH username'
required: true
ssh_key:
description: 'SSH private key'
required: true
ssh_host:
description: 'SSH host'
required: true
runs:
using: 'composite'
steps:
- run: |
SSH_PATH="$HOME/.ssh"
KNOWN_HOSTS_PATH="$SSH_PATH/known_hosts"
SSH_KEY_PRIVATE_PATH="$SSH_PATH/github_action"
mkdir -p "$SSH_PATH"
mkdir -p "$SSH_PATH/ctl"
ssh-keyscan -t rsa "${{ inputs.ssh_host }}" >> "$KNOWN_HOSTS_PATH"
echo "${{ inputs.ssh_key }}" > "$SSH_KEY_PRIVATE_PATH"
chmod 700 "$SSH_PATH"
chmod 644 "$KNOWN_HOSTS_PATH"
chmod 600 "$SSH_KEY_PRIVATE_PATH"
cat >>~/.ssh/config <<END
Host wpengine
HostName ${{ inputs.ssh_host }}
User ${{ inputs.ssh_user }}
IdentityFile $SSH_KEY_PRIVATE_PATH
StrictHostKeyChecking no
ControlMaster auto
ControlPath $SSH_PATH/ctl/%C
END
shell: bash