feat: add composite actions
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
name: backup
|
||||
description: backup all postgres databases
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: dump databases
|
||||
shell: bash
|
||||
run: |
|
||||
docker ps
|
||||
|
||||
# - name: backup databases
|
||||
# run: |
|
||||
@@ -0,0 +1,38 @@
|
||||
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
|
||||
|
||||
## replace with rsync for proper synchronization
|
||||
- name: copy directory
|
||||
shell: bash
|
||||
run: |
|
||||
scp -r ${{ inputs.source }} ${{ inputs.user }}@${{ inputs.host }}:${{ inputs.target }}
|
||||
@@ -0,0 +1,36 @@
|
||||
name: SSH runner
|
||||
description: run commands on SSH hosts
|
||||
inputs:
|
||||
host:
|
||||
description: SSH host
|
||||
required: true
|
||||
user:
|
||||
description: SSH user
|
||||
required: true
|
||||
key:
|
||||
description: SSH private key
|
||||
required: true
|
||||
script:
|
||||
description: commands to run via SSH
|
||||
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: run on docker host
|
||||
shell: bash
|
||||
run: |
|
||||
ssh ${{ inputs.user }}@${{ inputs.host }} << 'EOF'
|
||||
${{ inputs.script }}
|
||||
EOF
|
||||
Reference in New Issue
Block a user