Skip to content

Commit

Permalink
update action.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianjnuwu committed Sep 9, 2023
1 parent e558185 commit bb22cc1
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ inputs:
USER:
description: "An agent, which can be a human or software agent, using a computer or network service."
required: true
PASSWORLD:
description: ""
PASSWORD:
description: "Password to use if SSH key is not provided."
required: false
KEY:
description: "A component of the Secure Shell protocol suite used to establish secure shell sessions between remote computers over insecure networks, using cryptographic techniques."
Expand All @@ -28,7 +28,6 @@ inputs:
description: "Commands to be executed after the deploy (optional)."
required: false


runs:
using: "composite"
steps:
Expand All @@ -38,22 +37,11 @@ runs:
if [[ -n "${{ inputs.KEY }}" ]]; then
echo "${{ inputs.KEY }}" > ~/.ssh/ssh.key
chmod 600 ~/.ssh/ssh.key
fi
if [[ -n "${{ inputs.PASSWORLD }}" ]]; then
elif [[ -n "${{ inputs.PASSWORD }}" ]]; then
echo "PasswordAuthentication yes" > ~/.ssh/config
echo "${{ inputs.PASSWORD }}" > ~/.ssh/password.txt
fi
shell: bash
- name: 🍷 Setting the ssh Key...
run: |
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 }}";
Expand All @@ -68,5 +56,10 @@ runs:
shell: bash
- name: 🍷 Executing commands...
if: ${{ inputs.RUN }}
run: ssh ssh "${{ inputs.RUN }}"
run: |
if [[ -n "${{ inputs.KEY }}" ]]; then
ssh ssh "${{ inputs.RUN }}"
elif [[ -n "${{ inputs.PASSWORD }}" ]]; then
sshpass -p "$(cat ~/.ssh/password.txt)" ssh ${{ inputs.USER }}@${{ inputs.IP }} "${{ inputs.RUN }}"
fi
shell: bash

0 comments on commit bb22cc1

Please sign in to comment.