You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
SCP File Transfer
v0.1.0
GitHub Action for copying files and artifacts via SSH.
name: upload
on:
- push
jobs:
upload:
name: Upload
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@master
- name: Upload file via SSH
uses: nicklasfrahm/scp-action@main
with:
action: upload
host: ${{ secrets.SSH_TARGET_HOST }}
fingerprint: ${{ secrets.SSH_TARGET_FINGERPRINT }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
proxy_host: ${{ secrets.SSH_PROXY_HOST }}
proxy_fingerprint: ${{ secrets.SSH_PROXY_FINGERPRINT }}
proxy_username: ${{ secrets.SSH_USER }}
proxy_key: ${{ secrets.SSH_PRIVATE_KEY }}
source: |
path/to/source/a.txt
path/to/source/b.txt
target: path/to/target
name: download
on:
- push
jobs:
download:
name: Download
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@master
- name: Download file via SSH
uses: nicklasfrahm/scp-action@main
with:
action: download
host: ${{ secrets.SSH_TARGET_HOST }}
fingerprint: ${{ secrets.SSH_TARGET_FINGERPRINT }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
proxy_host: ${{ secrets.SSH_PROXY_HOST }}
proxy_fingerprint: ${{ secrets.SSH_PROXY_FINGERPRINT }}
proxy_username: ${{ secrets.SSH_USER }}
proxy_key: ${{ secrets.SSH_PRIVATE_KEY }}
source: |
path/to/source/a.txt
path/to/source/b.txt
target: path/to/target
See action.yml for more detailed information.
host
- ssh hostport
- ssh port, default is22
username
- ssh username, default isroot
timeout
- timeout for ssh to remote host, default is30s
action_timeout
- timeout for action, default is10m
key
- content of ssh private key. ex raw content of~/.ssh/id_rsa
fingerprint
- fingerprint SHA256 of the host public key, see Using host fingerprint verificationsource
- a list of files to copytarget
- a folder to copy to, default is.
direction
- either upload or download
SSH Proxy Settings:
proxy_host
- proxy hostproxy_port
- proxy port, default is22
proxy_username
- proxy username, default isroot
proxy_key
- content of ssh proxy private key.proxy_fingerprint
- fingerprint SHA256 of the proxy host public key, see Using host fingerprint verification
Setting up SSH host fingerprint verification can help to prevent Person-in-the-Middle attacks. Before setting this up, run the command below to get your SSH host fingerprint. Remember to replace ed25519
with your appropriate key type (rsa
, dsa
, etc.) that your server is using and example.com
with your host. In modern OpenSSH releases, the default key types to be fetched are rsa
(since version 5.1), ecdsa
(since version 6.0), and ed25519
(since version 6.7).
ssh example.com ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub | cut -d ' ' -f2
We would ❤️ for you to contribute to nicklasfrahm/scp-action
, pull requests are welcome!
This project is licensed under the MIT license.