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 9e1b915 commit 9c9bf58
Showing 1 changed file with 0 additions and 69 deletions.
69 changes: 0 additions & 69 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,69 +0,0 @@
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: "A unique identifier for a device on the Internet or a local network."
required: true
USER:
description: "An agent, which can be a human or software agent, using a computer or network service."
required: true
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."
required: false
REPO:
description: "The name of the repository where the action is located (default: the GitHub repository)."
default: ${{ github.repository }}
FOLDER:
description: 'The name of the folder where files are located, including the user (e.g., "/user/deploy").'
required: true
RUN:
description: "Commands to be executed after the deploy (optional)."
required: false

runs:
using: "composite"
steps:
- name: 🗿 Creating ssh files...
run: |
mkdir -p ~/.ssh/
if [[ -n "${{ inputs.KEY }}" ]]; then
echo "${{ inputs.KEY }}" > ~/.ssh/ssh.key
chmod 600 ~/.ssh/ssh.key
elif [[ -n "${{ inputs.PASSWORD }}" ]]; then
echo "PasswordAuthentication yes" > ~/.ssh/config
echo "${{ inputs.PASSWORD }}" > ~/.ssh/password.txt
fi
shell: bash
- name: ✨ Removing old files...
run: |
if [[ -n "${{ inputs.KEY }}" ]]; then
ssh ssh rm -rf "${{ inputs.FOLDER }}";
elif [[ -n "${{ inputs.PASSWORD }}" ]]; then
sshpass -p "$(cat ~/.ssh/password.txt)" ssh ${{ inputs.USER }}@${{ inputs.IP }} rm -rf "${{ inputs.FOLDER }}";
fi
shell: bash
- name: 💧 deploy to vps...
run: |
cd ..
IN="${{ inputs.REPO }}"
set -- "$IN"
IFS="/"; declare -a Array=($*)
scp -r ${Array[1]} ssh:/${{ inputs.FOLDER }}
shell: bash
- name: 🍷 Executing commands...
if: ${{ 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 9c9bf58

Please sign in to comment.