-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
45 lines (41 loc) · 1.42 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Tailscale SSH deploy
author: FarisZR
description: Deploy files with a custom command using Tailscale SSH
inputs:
remote_host:
description: 'The remote host to upload the directory to'
required: true
remote_destination:
description: 'The destination path on the remote host'
required: true
directory:
description: 'The local directory to upload'
required: true
post_upload_command:
description: 'A command to run on the remote host after the upload is finished'
required: false
runs:
using: 'composite'
steps:
- run: |
#!/bin/sh
set -eu
if [ -z "${{ inputs.remote_host }}" ]; then
echo "Input remote_host is required!"
exit 1
fi
if [ -z "${{ inputs.directory }}" ]; then
echo "Input directory is required!"
exit 1
fi
tar cjvf - -C "$GITHUB_WORKSPACE" "${{ inputs.directory }}" | ssh -o StrictHostKeyChecking=no "${{ inputs.remote_host }}" "cd ${{ inputs.remote_destination }} && tar -xjvf -"
echo "Upload finished"
if [ -n "${{ inputs.post_upload_command }}" ];
then
echo "Upload post command specified, runnig. ${{ inputs.post_upload_command }}"
ssh -o StrictHostKeyChecking=no "${{ inputs.remote_host }}" "eval ${{ inputs.post_upload_command }}"
fi
shell: bash
branding:
icon: terminal
color: white