local actions
This commit is contained in:
parent
1fe4eefef4
commit
357dfca282
2 changed files with 2 additions and 2 deletions
.forgejo/local-action
27
.forgejo/local-action/ssh-setup.yml
Normal file
27
.forgejo/local-action/ssh-setup.yml
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue