Skip to content

Commit 139d09f

Browse files
update action.yml
1 parent 1a5de0f commit 139d09f

File tree

1 file changed

+29
-45
lines changed

1 file changed

+29
-45
lines changed

action.yml

Lines changed: 29 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,22 @@ branding:
77

88
inputs:
99
IP:
10-
description: "A unique identifier for a device on the Internet or a local network."
10+
description: "The IP address is a unique identifier that identifies a device on the Internet or on a local network."
1111
required: true
1212
USER:
13-
description: "An agent, which can be a human or software agent, using a computer or network service."
13+
description: "A user is an agent, either a human agent or a software agent, who uses a computer or network service."
1414
required: true
15-
PASSWORD:
16-
description: "Password to use for SSH authentication. If provided, it will be used instead of the key."
17-
required: false
1815
KEY:
19-
description: "A component of the Secure Shell protocol suite used to establish secure shell sessions between remote computers over insecure networks, using cryptographic techniques."
20-
required: false
16+
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."
17+
required: true
2118
REPO:
22-
description: "The name of the repository where the action is located (default: the GitHub repository)."
19+
description: "Specify the name of the repository where the action is located."
2320
default: ${{ github.repository }}
2421
FOLDER:
25-
description: 'The name of the folder where files are located, including the user (e.g., "/user/deploy").'
22+
description: 'Name of the folder where the files are located, including the user (e.g., "user/deploy").'
2623
required: true
2724
RUN:
28-
description: "Commands to be executed after the deploy (optional)."
25+
description: "Specify the commands to be executed after the deploy."
2926
required: false
3027

3128
runs:
@@ -34,46 +31,33 @@ runs:
3431
- name: 🗿 Creating ssh files...
3532
run: |
3633
mkdir -p ~/.ssh/
37-
if [[ -n "${{ inputs.KEY }}" ]]; then
38-
echo "${{ inputs.KEY }}" > ~/.ssh/ssh.key
39-
chmod 600 ~/.ssh/ssh.key
40-
elif [[ -n "${{ inputs.PASSWORD }}" ]]; then
41-
echo "${{ inputs.PASSWORD }}" > ~/.ssh/password.txt
42-
fi
34+
echo "${{ inputs.KEY }}" > ~/.ssh/ssh.key
35+
chmod 600 ~/.ssh/ssh.key
36+
shell: bash
37+
- name: 🍷 Setting the ssh Key...
38+
run: |
39+
cat >>~/.ssh/config <<END
40+
Host ssh
41+
HostName ${{ inputs.IP }}
42+
User ${{ inputs.USER }}
43+
Port 22
44+
IdentityFile ~/.ssh/ssh.key
45+
StrictHostKeyChecking no
46+
END
4347
shell: bash
4448
- name: ✨ Removing old files...
4549
run: |
46-
ssh_options=""
47-
if [[ -n "${{ inputs.KEY }}" ]]; then
48-
ssh_options="-i ~/.ssh/ssh.key"
49-
elif [[ -n "${{ inputs.PASSWORD }}" ]]; then
50-
ssh_options="-o PasswordAuthentication=yes -o PubkeyAuthentication=no -i ~/.ssh/password.txt"
51-
fi
52-
ssh $ssh_options ${{ inputs.USER }}@${{ inputs.IP }} "rm -rf ${{
53-
inputs.FOLDER }}"
50+
ssh ssh rm -rf "${{ inputs.FOLDER }}";
5451
shell: bash
5552
- name: 💧 deploy to vps...
5653
run: |
57-
cd ..
58-
IN="${{ inputs.REPO }}"
59-
set -- "$IN"
60-
IFS="/"; declare -a Array=($*)
61-
scp_options=""
62-
if [[ -n "${{ inputs.KEY }}" ]]; then
63-
scp_options="-i ~/.ssh/ssh.key"
64-
elif [[ -n "${{ inputs.PASSWORD }}" ]]; then
65-
scp_options="-o PasswordAuthentication=yes -o PubkeyAuthentication=no -i ~/.ssh/password.txt"
66-
fi
67-
scp -r $scp_options ${Array[1]} ${{ inputs.USER }}@${{ inputs.IP }}:${{ inputs.FOLDER }}
68-
shell: bash
54+
cd ..
55+
IN="${{ inputs.REPO }}"
56+
set -- "$IN"
57+
IFS="/"; declare -a Array=($*)
58+
scp -r ${Array[1]} ssh:/${{ inputs.FOLDER }}
59+
shell: bash
6960
- name: 🍷 Executing commands...
7061
if: ${{ inputs.RUN }}
71-
run: |
72-
ssh_options=""
73-
if [[ -n "${{ inputs.KEY }}" ]]; then
74-
ssh_options="-i ~/.ssh/ssh.key"
75-
elif [[ -n "${{ inputs.PASSWORD }}" ]]; then
76-
ssh_options="-o PasswordAuthentication=yes -o PubkeyAuthentication=no -i ~/.ssh/password.txt"
77-
fi
78-
ssh $ssh_options ${{ inputs.USER }}@${{ inputs.IP }} "${{ inputs.RUN }}"
79-
shell: bash
62+
run: ssh ssh "${{ inputs.RUN }}"
63+
shell: bash

0 commit comments

Comments
 (0)