local actions

This commit is contained in:
Firq 2023-12-19 22:24:44 +01:00
parent 1fe4eefef4
commit 357dfca282
Signed by: Firq
GPG key ID: 3ACC61C8CEC83C20
2 changed files with 2 additions and 2 deletions
.forgejo/local-action

View file

@ -0,0 +1,27 @@
name: "ssh & rsync setup"
inputs:
SSH_KNOWN_HOSTS:
required: true
description: "Known hosts file to use"
DEPLOY_HOST:
required: true
description: "hostname"
SSH_PRIVATE_KEY:
required: true
description: "SSH private key"
runs:
using: "composite"
steps:
- run: 'which rsync || ( apt update -y && apt install rsync -y )'
- run: 'which ssh-agent || ( apt update -y && apt install openssh-client -y)'
- run: eval $(ssh-agent -s)
- run: mkdir -p ~/.ssh
- run: chmod 700 ~/.ssh
- run: echo "$SSH_PRIVATE_KEY" | tr -d '\r' >> ~/.ssh/key_firq
- run: chmod 600 ~/.ssh/key_firq
- run: echo "Host $DEPLOY_HOST" >> ~/.ssh/config
- run: echo $'\n\tIdentityFile ~/.ssh/key_firq' >> ~/.ssh/config
- run: echo $'\n\tStrictHostKeyChecking no\n\tIdentitiesOnly yes\n' >> ~/.ssh/config
- run: chmod 644 ~/.ssh/config
- run: echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- run: chmod 644 ~/.ssh/known_hosts