-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
action.yml
78 lines (76 loc) · 2.63 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: ssh-action-deploy
description: "Deploy has never been so easy, running commands has never been simpler..."
author: "sebastianjnuwu"
branding:
icon: "terminal"
color: "purple"
inputs:
IP:
description: "The IP address is a unique identifier that identifies a device on the Internet or on a local network."
required: true
USER:
description: "A user is an agent, either a human agent or a software agent, who uses a computer or network service."
required: true
KEY:
description: "ssh-keygen is a standard component of the Secure Shell protocol suite found on Unix, Unix-like, and Microsoft Windows computer systems used to establish secure shell sessions between remote computers over insecure networks, through the use of various cryptographic techniques."
required: true
REPO:
description: "Specify the name of the repository where the action is located."
default: ${{ github.repository }}
FOLDER:
description: 'Name of the folder where the files are located, including the user (e.g., "user/deploy").'
required: true
RUN:
description: "Specify the commands to be executed after the deploy."
required: false
COMPATABILITY:
description: "Add the '-O' compatability flag to the SCP command for targets with older verions of OPENSSH (ie: Ubuntu 14.X)."
required: false
type: boolean
runs:
using: "composite"
steps:
- name: 🗿 Creating ssh files...
run: |
mkdir -p ~/.ssh/
echo "${{ inputs.KEY }}" > ~/.ssh/ssh.key
chmod 600 ~/.ssh/ssh.key
shell: bash
- name: 🍷 Setting the ssh Key...
run: |
echo ${{ inputs.IP }}
cat >>~/.ssh/config <<END
Host ssh
HostName ${{ inputs.IP }}
User ${{ inputs.USER }}
Port 22
IdentityFile ~/.ssh/ssh.key
StrictHostKeyChecking no
END
shell: bash
- name: ✨ Removing old files...
run: |
ssh ssh rm -rf "${{ inputs.FOLDER }}";
shell: bash
- name: 💧 deploy to vps...
if: inputs.COMPATABILITY == 'false'
run: |
cd ..
IN="${{ inputs.REPO }}"
set -- "$IN"
IFS="/"; declare -a Array=($*)
scp -r ${Array[1]} ssh:/${{ inputs.FOLDER }}
shell: bash
- name: 💧 deploy to vps with compatability...
if: inputs.COMPATABILITY == 'true'
run: |
cd ..
IN="${{ inputs.REPO }}"
set -- "$IN"
IFS="/"; declare -a Array=($*)
scp -O -r ${Array[1]} ssh:/${{ inputs.FOLDER }}
shell: bash
- name: 🍷 Executing commands...
if: ${{ inputs.RUN }}
run: ssh ssh "${{ inputs.RUN }}"
shell: bash