This commit is contained in:
Oystein Kristoffer Tveit 2024-05-01 15:08:12 +02:00
parent 21c9eb7fa1
commit 9fad4d0935
Signed by: oysteikt
GPG Key ID: 9F2F7D8250F35146
1 changed files with 11 additions and 5 deletions

View File

@ -59,11 +59,12 @@ runs:
- name: Install SSH config
run: |
echo "Installing SSH config"
echo <<EOF > ~/.ssh/config
cat <<EOF > ~/.ssh/config
Host targethost
User ${{ inputs.username }}
HostName ${{ inputs.host }}
Port ${{ inputs.port }}
IdentityFile ~/.ssh/key
ForwardAgent no
ForwardX11 no
PasswordAuthentication no
@ -85,17 +86,22 @@ runs:
shell: bash
if: ${{ inputs.known-host-content == null }}
- name: Install SSH key
run: |
echo "Installing SSH key"
echo "${{ inputs.ssh-key }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "${{ inputs.ssh-key }}" > ~/.ssh/key
chmod 600 ~/.ssh/key
shell: bash
if: ${{ inputs.ssh-key != null }}
- name: Transfer files
run: |
echo "Transferring files"
rsync ${{ inputs.args }} "${{ inputs.source }}" "targethost:${{ inputs.target }}"
rsync ${{ inputs.args }} "${{ inputs.source }}" --rsh "ssh -F ~/.ssh/config" "targethost:${{ inputs.target }}"
shell: bash
- name: Cleanup
run: |
echo "Cleaning up"
rm -f ~/.ssh/{config,key,known_hosts} || true
shell: bash