mirror of
https://github.com/appleboy/scp-action.git
synced 2026-07-10 22:05:39 +00:00
Compare commits
4 Commits
f042d742db
...
3d59448764
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d59448764 | ||
|
|
2a829c0ed2 | ||
|
|
4f2c27bbc2 | ||
|
|
b03d7257ae |
99
README.md
99
README.md
@ -4,7 +4,7 @@
|
||||
|
||||
[](https://github.com/appleboy/scp-action/actions)
|
||||
|
||||
**Important**: Only support **Linux** [docker](https://www.docker.com/) container.
|
||||
**Important**: Only supports **Linux** [docker](https://www.docker.com/) containers.
|
||||
|
||||
## Usage
|
||||
|
||||
@ -14,7 +14,6 @@ Copy files and artifacts via SSH:
|
||||
name: scp files
|
||||
on: [push]
|
||||
jobs:
|
||||
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
@ -35,46 +34,50 @@ jobs:
|
||||
|
||||
See the [action.yml](./action.yml) file for more detail information.
|
||||
|
||||
* host - scp remote host
|
||||
* port - scp remote port, default is `22`
|
||||
* username - scp username
|
||||
* password - scp password
|
||||
* passphrase - the passphrase is usually to encrypt the private key
|
||||
* protocol - The IP protocol to use. Valid values are `tcp`. `tcp4` or `tcp6`. Default to `tcp`.
|
||||
* fingerprint - fingerprint SHA256 of the host public key, default is to skip verification
|
||||
* timeout - timeout for ssh to remote host, default is `30s`
|
||||
* command_timeout - timeout for scp command, default is `10m`
|
||||
* key - content of ssh private key. ex raw content of ~/.ssh/id_rsa
|
||||
* key_path - path of ssh private key
|
||||
* target - target path on the server, must be a directory (**required**)
|
||||
* source - scp file list (**required**)
|
||||
* rm - remove target folder before upload data, default is `false`
|
||||
* strip_components - remove the specified number of leading path elements.
|
||||
* overwrite - use `--overwrite` flag with tar, overwrite existing files when extracting
|
||||
* tar_tmp_path - temporary path for tar file on the dest host
|
||||
* tar_exec - path to tar executable on the dest host. default is `tar`
|
||||
* tar_dereference - use `--dereference` flag with tar, follow symlinks; archive and dump the files they point to
|
||||
* use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15))
|
||||
| Variable | Description | Default Value |
|
||||
| ------------------- | ----------------------------------------------------------------------------------------------------------- | ------------- |
|
||||
| host | SCP remote host | - |
|
||||
| port | SCP remote port | `22` |
|
||||
| username | SCP username | - |
|
||||
| password | SCP password | - |
|
||||
| passphrase | The passphrase is usually used to encrypt the private key | - |
|
||||
| protocol | The IP protocol to use. Valid values are `tcp`, `tcp4`, or `tcp6`. | `tcp` |
|
||||
| fingerprint | Fingerprint SHA256 of the host public key. Default is to skip verification | - |
|
||||
| timeout | Timeout for SSH to remote host | `30s` |
|
||||
| command_timeout | Timeout for SCP command | `10m` |
|
||||
| key | Content of SSH private key. e.g., raw content of ~/.ssh/id_rsa | - |
|
||||
| key_path | Path of SSH private key | - |
|
||||
| target | Target path on the server, must be a directory (**required**) | - |
|
||||
| source | SCP file list (**required**) | - |
|
||||
| rm | Remove target folder before uploading data | `false` |
|
||||
| strip_components | Remove the specified number of leading path elements | - |
|
||||
| overwrite | Use `--overwrite` flag with tar, overwrite existing files when extracting | - |
|
||||
| tar_tmp_path | Temporary path for tar file on the destination host | - |
|
||||
| tar_exec | Path to tar executable on the destination host | `tar` |
|
||||
| tar_dereference | Use `--dereference` flag with tar, follow symlinks; archive and dump the files they point to | - |
|
||||
| use_insecure_cipher | Include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) | - |
|
||||
|
||||
SSH Proxy Setting:
|
||||
|
||||
* proxy_host - proxy host
|
||||
* proxy_port - proxy port, default is `22`
|
||||
* proxy_username - proxy username
|
||||
* proxy_password - proxy password
|
||||
* proxy_protocol - The IP protocol to use. Valid values are `tcp`. `tcp4` or `tcp6`. Default to `tcp`.
|
||||
* proxy_passphrase - the passphrase is usually to encrypt the private key
|
||||
* proxy_timeout - timeout for ssh to proxy host, default is `30s`
|
||||
* proxy_key - content of ssh proxy private key.
|
||||
* proxy_key_path - path of ssh proxy private key
|
||||
* proxy_fingerprint - fingerprint SHA256 of the host public key, default is to skip verification
|
||||
* proxy_use_insecure_cipher - include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15))
|
||||
| Variable | Description | Default Value |
|
||||
| ------------------------- | ----------------------------------------------------------------------------------------------------------- | ------------- |
|
||||
| proxy_host | Proxy host | - |
|
||||
| proxy_port | Proxy port | `22` |
|
||||
| proxy_username | Proxy username | - |
|
||||
| proxy_password | Proxy password | - |
|
||||
| proxy_protocol | The IP protocol to use. Valid values are `tcp`, `tcp4`, or `tcp6`. | `tcp` |
|
||||
| proxy_passphrase | The passphrase is usually used to encrypt the private key | - |
|
||||
| proxy_timeout | Timeout for SSH to proxy host | `30s` |
|
||||
| proxy_key | Content of SSH proxy private key | - |
|
||||
| proxy_key_path | Path of SSH proxy private key | - |
|
||||
| proxy_fingerprint | Fingerprint SHA256 of the host public key. Default is to skip verification | - |
|
||||
| proxy_use_insecure_cipher | Include more ciphers with use_insecure_cipher (see [#15](https://github.com/appleboy/scp-action/issues/15)) | - |
|
||||
|
||||
## Setting up a SSH Key
|
||||
|
||||
Make sure to follow the below steps while creating SSH Keys and using them.
|
||||
The best practice is create the SSH Keys on local machine not remote machine.
|
||||
Login with username specified in Github Secrets. Generate a RSA Key-Pair:
|
||||
Make sure to follow the steps below when creating and using SSH keys.
|
||||
The best practice is to create the SSH keys on the local machine, not the remote machine.
|
||||
Log in with the username specified in GitHub Secrets and generate an RSA key pair:
|
||||
|
||||
```bash
|
||||
# rsa
|
||||
@ -108,9 +111,9 @@ See the detail information about [SSH login without password](http://www.linuxpr
|
||||
|
||||
**A note** from one of our readers: Depending on your version of SSH you might also have to do the following changes:
|
||||
|
||||
* Put the public key in `.ssh/authorized_keys2`
|
||||
* Change the permissions of `.ssh` to 700
|
||||
* Change the permissions of `.ssh/authorized_keys2` to 640
|
||||
- Put the public key in `.ssh/authorized_keys2`
|
||||
- Change the permissions of `.ssh` to 700
|
||||
- Change the permissions of `.ssh/authorized_keys2` to 640
|
||||
|
||||
### If you are using OpenSSH
|
||||
|
||||
@ -149,6 +152,20 @@ Copy file via a SSH password:
|
||||
target: your_server_target_folder_path
|
||||
```
|
||||
|
||||
Using the environment variables
|
||||
|
||||
```yaml
|
||||
- name: copy file via ssh password
|
||||
uses: appleboy/scp-action@v0.1.7
|
||||
with:
|
||||
host: ${{ env.HOST }}
|
||||
username: ${{ env.USERNAME }}
|
||||
password: ${{ secrets.PASSWORD }}
|
||||
port: ${{ env.PORT }}
|
||||
source: "tests/a.txt,tests/b.txt"
|
||||
target: ${{ env.TARGET_PATH }}
|
||||
```
|
||||
|
||||
Copy file via a SSH key:
|
||||
|
||||
```yaml
|
||||
@ -208,7 +225,7 @@ Example configuration for exclude custom files:
|
||||
Upload artifact files to remote server:
|
||||
|
||||
```yaml
|
||||
deploy:
|
||||
deploy:
|
||||
name: deploy artifact
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@ -273,7 +290,7 @@ foobar
|
||||
Only copy files that are newer than the corresponding destination files:
|
||||
|
||||
```yaml
|
||||
changes:
|
||||
changes:
|
||||
name: test changed-files
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user