-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
145 lines (137 loc) · 4.3 KB
/
action.yml
File metadata and controls
145 lines (137 loc) · 4.3 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: 'SSH Sync Action'
description: 'Execute SSH commands and bidirectional file transfers via rsync and scp'
author: 'Your Name'
branding:
icon: 'upload-cloud'
color: 'blue'
inputs:
host:
description: 'SSH remote host'
required: true
port:
description: 'SSH remote port'
required: false
default: '22'
user:
description: 'SSH remote user'
required: true
pass:
description: 'SSH remote password'
required: false
key:
description: 'SSH private key as string'
required: false
connect_timeout:
description: 'Connection timeout to remote host'
required: false
default: '30s'
first_ssh:
description: 'Execute commands before syncing data'
required: false
scp_upload:
description: 'Upload from local to remote using scp'
required: false
scp_download:
description: 'Download from remote to local using scp'
required: false
rsync_upload:
description: 'Upload from local to remote using rsync'
required: false
rsync_download:
description: 'Download from remote to local using rsync'
required: false
last_ssh:
description: 'Execute commands after syncing data'
required: false
scp_options:
description: 'Additional scp command options'
required: false
default: ''
rsync_options:
description: 'Additional rsync command options'
required: false
default: '-avz --delete'
ssh_options:
description: 'Additional SSH options'
required: false
default: ''
runs:
using: 'composite'
steps:
- name: 'Setup SSH key'
shell: bash
run: ${{ github.action_path }}/src/setup-ssh.sh
env:
SSH_KEY: ${{ inputs.key }}
SSH_PORT: ${{ inputs.port }}
SSH_HOST: ${{ inputs.host }}
- name: 'First SSH commands'
uses: appleboy/ssh-action@master
with:
host: ${{ inputs.host }}
port: ${{ inputs.port }}
username: ${{ inputs.user }}
password: ${{ inputs.pass }}
key: ${{ inputs.key }}
script: ${{ inputs.first_ssh }}
timeout: ${{ inputs.connect_timeout }}
if: ${{ inputs.first_ssh != '' }}
- name: 'Upload data using rsync'
shell: bash
run: ${{ github.action_path }}/src/rsync-upload.sh
env:
SSH_HOST: ${{ inputs.host }}
SSH_PORT: ${{ inputs.port }}
SSH_USER: ${{ inputs.user }}
SSH_PASS: ${{ inputs.pass }}
SSH_OPTIONS: ${{ inputs.ssh_options }}
RSYNC_OPTIONS: ${{ inputs.rsync_options }}
RSYNC_UPLOAD_CONFIG: ${{ inputs.rsync_upload }}
if: ${{ inputs.rsync_upload != '' }}
- name: 'Upload data using scp'
shell: bash
run: ${{ github.action_path }}/src/scp-upload.sh
env:
SSH_HOST: ${{ inputs.host }}
SSH_PORT: ${{ inputs.port }}
SSH_USER: ${{ inputs.user }}
SSH_PASS: ${{ inputs.pass }}
SSH_OPTIONS: ${{ inputs.ssh_options }}
SCP_OPTIONS: ${{ inputs.scp_options }}
SCP_UPLOAD_CONFIG: ${{ inputs.scp_upload }}
if: ${{ inputs.scp_upload != '' }}
- name: 'Download data using rsync'
shell: bash
run: ${{ github.action_path }}/src/rsync-download.sh
env:
SSH_HOST: ${{ inputs.host }}
SSH_PORT: ${{ inputs.port }}
SSH_USER: ${{ inputs.user }}
SSH_PASS: ${{ inputs.pass }}
SSH_OPTIONS: ${{ inputs.ssh_options }}
RSYNC_OPTIONS: ${{ inputs.rsync_options }}
RSYNC_DOWNLOAD_CONFIG: ${{ inputs.rsync_download }}
if: ${{ inputs.rsync_download != '' }}
- name: 'Download data using scp'
shell: bash
run: ${{ github.action_path }}/src/scp-download.sh
env:
SSH_HOST: ${{ inputs.host }}
SSH_PORT: ${{ inputs.port }}
SSH_USER: ${{ inputs.user }}
SSH_PASS: ${{ inputs.pass }}
SSH_OPTIONS: ${{ inputs.ssh_options }}
SCP_OPTIONS: ${{ inputs.scp_options }}
SCP_DOWNLOAD_CONFIG: ${{ inputs.scp_download }}
if: ${{ inputs.scp_download != '' }}
- name: 'Last SSH commands'
uses: appleboy/ssh-action@master
with:
host: ${{ inputs.host }}
port: ${{ inputs.port }}
username: ${{ inputs.user }}
password: ${{ inputs.pass }}
key: ${{ inputs.key }}
script: ${{ inputs.last_ssh }}
timeout: ${{ inputs.connect_timeout }}
if: ${{ inputs.last_ssh != '' }}