fgo-ta-com-website/.forgejo/local-action/ssh-setup.yml
Firq 357dfca282
Some checks failed
/ checking (push) Successful in 1m30s
/ build-site (push) Successful in 24s
/ deploy-site (push) Failing after 1s
local actions
2023-12-19 22:24:44 +01:00

28 lines
1,003 B
YAML

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