scp copies files between hosts on a network. It uses ssh for data transfer, and uses the same authentication and provides the same security as ssh.
Store your username and password in your repos secrets vault, more info on this here.
From within your GitHub Workflow simply add a job/step to deploy your codebase to the appropriate server:
jobs:
deploy:
- uses: utahcon/[email protected]
with:
server: example.org
username: ${{ secrets.SCP_USERNAME }}
private-key: ${{ secrets.SCP_PRIVATE_KEY }}
source: "public/*"
destination: "/var/www/public"
recursive: true
The following are the inputs expected/accepted when using action-scp
Input | Description | Required | Default |
---|---|---|---|
server | Specifies the remote host to send files to | true | |
port | Specifies the remote hosts port for sending files to | false | 22 |
username | Username for authentication with server (use GitHub Secrets only) | true | |
password | Password for authentication with server (use GitHub Secrets only) | false | |
private-key | Private key used for key-based authentication with server (use GitHub Secrets only) | false | |
source | Path you wish to send to remote host. | true | . |
destination | Path on remote host to store files | true | . |
recursive | Flag to denote recursive copy of directory. Note that scp follows symbolic links encountered in the tree traversal | false | |
jumps | Connect to the target host by first making an scp connection to the jump host described by destination and then establishing a TCP forwarding to the ultimate destination from there. Multiple jump hops may be specified separated by comma characters. | false | |
ssh-options | Can be used to pass options to ssh in the format used in ssh_config. This is useful for specifying options for which there is no separate scp command-line flag. For full details of the options listed below, and their possible values, see ssh_config. Comma separated. AddressFamily BatchMode BindAddress BindInterface CanonicalDomains CanonicalizeFallbackLocal CanonicalizeHostname CanonicalizeMaxDots CanonicalizePermittedCNAMEs CASignatureAlgorithms CertificateFile ChallengeResponseAuthentication CheckHostIP Ciphers Compression ConnectionAttempts ConnectTimeout ControlMaster ControlPath ControlPersist GlobalKnownHostsFile GSSAPIAuthentication GSSAPIDelegateCredentials HashKnownHosts Host HostbasedAuthentication HostbasedKeyTypes HostKeyAlgorithms HostKeyAlias Hostname IdentitiesOnly IdentityAgent IdentityFile IPQoS KbdInteractiveAuthentication KbdInteractiveDevices KexAlgorithms LogLevel MACs NoHostAuthenticationForLocalhost NumberOfPasswordPrompts PasswordAuthentication PKCS11Provider Port PreferredAuthentications ProxyCommand ProxyJump PubkeyAcceptedKeyTypes PubkeyAuthentication RekeyLimit SendEnv ServerAliveInterval ServerAliveCountMax SetEnv StrictHostKeyChecking TCPKeepAlive UpdateHostKeys User UserKnownHostsFile VerifyHostKeyDNS |
false |