allow auto extarct
This commit is contained in:
parent
408ca30608
commit
bd4da76485
2 changed files with 15 additions and 5 deletions
11
action.yml
11
action.yml
|
@ -1,9 +1,9 @@
|
||||||
name: 'SCP deploy action'
|
name: 'SCP Deploy Smart'
|
||||||
description: 'Action to send dist files to a remote server with scp command'
|
description: 'Action to send dist files to a remote server with scp command'
|
||||||
author: 'Fabricio Nogueira'
|
author: 'Fabricio Nogueira & Jackz'
|
||||||
inputs:
|
inputs:
|
||||||
src:
|
src:
|
||||||
description: 'Sorce dir to deploy'
|
description: 'Source dir to deploy'
|
||||||
required: true
|
required: true
|
||||||
host:
|
host:
|
||||||
description: 'SSH address'
|
description: 'SSH address'
|
||||||
|
@ -14,7 +14,7 @@ inputs:
|
||||||
port:
|
port:
|
||||||
description: 'SSH Port'
|
description: 'SSH Port'
|
||||||
required: false
|
required: false
|
||||||
default: 22
|
default: "22"
|
||||||
user:
|
user:
|
||||||
description: 'SSH User name'
|
description: 'SSH User name'
|
||||||
required: true
|
required: true
|
||||||
|
@ -24,6 +24,9 @@ inputs:
|
||||||
options:
|
options:
|
||||||
description: 'Extra options for scp'
|
description: 'Extra options for scp'
|
||||||
required: false
|
required: false
|
||||||
|
extract:
|
||||||
|
description: 'Is src a tar file to be extracted?'
|
||||||
|
required: false
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
image: 'Dockerfile'
|
image: 'Dockerfile'
|
||||||
|
|
|
@ -15,9 +15,16 @@ echo "Local Path: ${INPUT_SRC}"
|
||||||
echo "Remote Path: ${INPUT_REMOTE}"
|
echo "Remote Path: ${INPUT_REMOTE}"
|
||||||
echo "Commit: ${COMMIT_SHA}"
|
echo "Commit: ${COMMIT_SHA}"
|
||||||
|
|
||||||
|
if [[ -z "$INPUT_EXTRACT"]]; then
|
||||||
|
# SCP normal files
|
||||||
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE \
|
scp -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE \
|
||||||
-P "${INPUT_PORT}" $INPUT_OPTIONS -r ${INPUT_SRC} "${INPUT_USER}"@"${INPUT_HOST}":"${INPUT_REMOTE}/${COMMIT_SHA}"
|
-P "${INPUT_PORT}" $INPUT_OPTIONS -r ${INPUT_SRC} "${INPUT_USER}"@"${INPUT_HOST}":"${INPUT_REMOTE}/${COMMIT_SHA}"
|
||||||
|
elif
|
||||||
|
# Untar directly via SSh
|
||||||
|
ssh -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE \
|
||||||
|
"${INPUT_USER}"@"${INPUT_HOST}" -p "${INPUT_PORT}" \
|
||||||
|
-C "mkdir ${INPUT_REMOTE}/${COMMIT_SHA} && cd ${INPUT_REMOTE}/${COMMIT_SHA} && tar -xvv" < $INPUT_SRC
|
||||||
|
fi
|
||||||
echo "File transfer complete. Symlinking and purging old entries"
|
echo "File transfer complete. Symlinking and purging old entries"
|
||||||
ssh -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE \
|
ssh -o StrictHostKeyChecking=no -v -i __TEMP_INPUT_KEY_FILE \
|
||||||
"${INPUT_USER}"@"${INPUT_HOST}" -p "${INPUT_PORT}" \
|
"${INPUT_USER}"@"${INPUT_HOST}" -p "${INPUT_PORT}" \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue