42 lines
965 B
YAML
42 lines
965 B
YAML
name: SSH copy
|
|
description: copy files to SSH hosts
|
|
inputs:
|
|
host:
|
|
description: SSH host
|
|
required: true
|
|
user:
|
|
description: SSH user
|
|
required: true
|
|
key:
|
|
description: SSH private key
|
|
required: true
|
|
source:
|
|
description: directory to copy
|
|
required: true
|
|
target:
|
|
description: destination path on remote
|
|
required: true
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: setup ssh
|
|
shell: bash
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ inputs.key }}" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
|
|
- name: add remote host to known_hosts
|
|
shell: bash
|
|
run: ssh-keyscan -H "${{ inputs.host }}" >> ~/.ssh/known_hosts
|
|
|
|
- name: install rsync
|
|
shell: bash
|
|
run: sudo apt-get update && sudo apt-get install -y rsync
|
|
|
|
- name: rsync directory
|
|
shell: bash
|
|
run: |
|
|
rsync -avz --delete ${{ inputs.source }} ${{ inputs.user }}@${{ inputs.host }}:${{ inputs.target }}
|