-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e1b915
commit 9c9bf58
Showing
1 changed file
with
0 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||