mirror of
https://github.com/appleboy/scp-action.git
synced 2024-12-19 22:09:05 +00:00
docs: update readme.
This commit is contained in:
parent
afd2e26f9f
commit
c0a815a115
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
@ -9,12 +9,11 @@ jobs:
|
|||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
- name: copy file via ssh password
|
- name: copy file via ssh password
|
||||||
uses: appleboy/scp-action@master
|
uses: appleboy/scp-action@master
|
||||||
env:
|
|
||||||
HOST: ${{ secrets.HOST }}
|
|
||||||
USERNAME: ${{ secrets.USERNAME }}
|
|
||||||
PASSWORD: ${{ secrets.PASSWORD }}
|
|
||||||
PORT: ${{ secrets.PORT }}
|
|
||||||
with:
|
with:
|
||||||
|
host: ${{ secrets.HOST }}
|
||||||
|
username: ${{ secrets.USERNAME }}
|
||||||
|
password: ${{ secrets.PASSWORD }}
|
||||||
|
port: ${{ secrets.PORT }}
|
||||||
source: "tests/a.txt,tests/b.txt"
|
source: "tests/a.txt,tests/b.txt"
|
||||||
target: "test"
|
target: "test"
|
||||||
|
|
||||||
|
190
README.md
190
README.md
@ -2,27 +2,23 @@
|
|||||||
|
|
||||||
[GitHub Action](https://developer.github.com/actions/) for copying files and artifacts via SSH.
|
[GitHub Action](https://developer.github.com/actions/) for copying files and artifacts via SSH.
|
||||||
|
|
||||||
<img src="./images/copy-multiple-file.png">
|
![ssh key](./images/copy-multiple-file.png)
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
copy files and artifacts via SSH as blow.
|
copy files and artifacts via SSH as blow.
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
action "Copy multiple file" {
|
- name: copy file via ssh password
|
||||||
uses = "appleboy/scp-action@master"
|
uses: appleboy/scp-action@master
|
||||||
env = {
|
env:
|
||||||
HOST = "example.com"
|
HOST: ${{ secrets.HOST }}
|
||||||
USERNAME = "foo"
|
USERNAME: ${{ secrets.USERNAME }}
|
||||||
PASSWORD = "bar"
|
PASSWORD: ${{ secrets.PASSWORD }}
|
||||||
PORT = "22"
|
PORT: ${{ secrets.PORT }}
|
||||||
SOURCE = "tests/a.txt,tests/b.txt"
|
with:
|
||||||
TARGET = "/home/foo/test"
|
source: "tests/a.txt,tests/b.txt"
|
||||||
}
|
target: "test
|
||||||
secrets = [
|
|
||||||
"PASSWORD",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Environment variables
|
## Environment variables
|
||||||
@ -39,127 +35,75 @@ action "Copy multiple file" {
|
|||||||
|
|
||||||
Copy file via ssh password
|
Copy file via ssh password
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
action "Copy multiple file" {
|
- name: copy file via ssh password
|
||||||
uses = "appleboy/scp-action@master"
|
uses: appleboy/scp-action@master
|
||||||
env = {
|
with:
|
||||||
HOST = "example.com"
|
host: example.com
|
||||||
USERNAME = "foo"
|
username: foo
|
||||||
PORT = "22"
|
password: bar
|
||||||
SOURCE = "tests/a.txt,tests/b.txt"
|
port: 22
|
||||||
TARGET = "/home/foo/test"
|
source: "tests/a.txt,tests/b.txt"
|
||||||
}
|
target: "test"
|
||||||
secrets = [
|
|
||||||
"PASSWORD",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Copy file via ssh key
|
Copy file via ssh key
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
action "Copy file via ssh key" {
|
- name: copy file via ssh key
|
||||||
uses = "appleboy/scp-action@master"
|
uses: appleboy/scp-action@master
|
||||||
env = {
|
env:
|
||||||
HOST = "example.com"
|
HOST: ${{ secrets.HOST }}
|
||||||
USERNAME = "foo"
|
USERNAME: ${{ secrets.USERNAME }}
|
||||||
PORT = "22"
|
PORT: ${{ secrets.PORT }}
|
||||||
SOURCE = "tests/c.txt,tests/d.txt"
|
KEY: ${{ secrets.KEY }}
|
||||||
TARGET = "/home/actions/test"
|
with:
|
||||||
}
|
source: "tests/a.txt,tests/b.txt"
|
||||||
secrets = [
|
target: "test"
|
||||||
"KEY",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Example configuration for ignore list:
|
Example configuration for ignore list:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
action "reqular expression list" {
|
- name: copy file via ssh key
|
||||||
uses = "appleboy/scp-action@master"
|
uses: appleboy/scp-action@master
|
||||||
env = {
|
env:
|
||||||
HOST = "example.com"
|
HOST: ${{ secrets.HOST }}
|
||||||
USERNAME = "foo"
|
USERNAME: ${{ secrets.USERNAME }}
|
||||||
PORT = "22"
|
PORT: ${{ secrets.PORT }}
|
||||||
SOURCE = "tests/*.txt,!tests/a.txt"
|
KEY: ${{ secrets.KEY }}
|
||||||
TARGET = "/home/actions/test"
|
with:
|
||||||
}
|
source: "tests/*.txt,!tests/a.txt"
|
||||||
secrets = [
|
target: "test"
|
||||||
"KEY",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Example configuration for multiple server
|
Example configuration for multiple server
|
||||||
|
|
||||||
```diff
|
```diff
|
||||||
action "reqular expression list" {
|
- name: copy file via ssh password
|
||||||
uses = "appleboy/scp-action@master"
|
uses: appleboy/scp-action@master
|
||||||
env = {
|
with:
|
||||||
- HOST = "example.com"
|
- host: "example.com"
|
||||||
+ HOST = "foo.com,bar.com"
|
+ host: "foo.com,bar.com"
|
||||||
USERNAME = "foo"
|
username: foo
|
||||||
PORT = "22"
|
password: bar
|
||||||
SOURCE = "tests/*.txt,!tests/a.txt"
|
port: 22
|
||||||
TARGET = "/home/actions/test"
|
source: "tests/a.txt,tests/b.txt"
|
||||||
}
|
target: "test"
|
||||||
secrets = [
|
|
||||||
"KEY",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Example configuration for custom secret for ssh password
|
## Input variables
|
||||||
|
|
||||||
```
|
see the [action.yml](./action.yml) file for more detail imformation.
|
||||||
action "Add secret in args" {
|
|
||||||
uses = "appleboy/scp-action@master"
|
|
||||||
env = {
|
|
||||||
TARGET = "/home/actions/test1234"
|
|
||||||
}
|
|
||||||
secrets = [
|
|
||||||
"HOST",
|
|
||||||
"TEST_USERNAME",
|
|
||||||
"TEST_PASSWORD",
|
|
||||||
"KEY",
|
|
||||||
]
|
|
||||||
args = [
|
|
||||||
"--username", "$TEST_USERNAME",
|
|
||||||
"--password", "$TEST_PASSWORD",
|
|
||||||
"--source", "tests/a.txt",
|
|
||||||
"--source", "tests/b.txt",
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
see the detail of `drone-scp` command
|
* host - scp remote host
|
||||||
|
* port - scp remote port
|
||||||
```
|
* username - scp username
|
||||||
--host value, -H value Server host [$PLUGIN_HOST, $SCP_HOST, $SSH_HOST, $HOST]
|
* password - scp password
|
||||||
--port value, -P value Server port, default to 22 (default: "22") [$PLUGIN_PORT, $SCP_PORT, $SSH_PORT, $PORT]
|
* timeout - timeout for ssh to remote host
|
||||||
--username value, -u value Server username [$PLUGIN_USERNAME, $PLUGIN_USER, $SCP_USERNAME, $SSH_USERNAME, $USERNAME]
|
* command_timeout - timeout for scp command
|
||||||
--password value, -p value Password for password-based authentication [$PLUGIN_PASSWORD, $SCP_PASSWORD, $SSH_PASSWORD, $PASSWORD]
|
* key - content of ssh private key. ex raw content of ~/.ssh/id_rsa
|
||||||
--timeout value connection timeout (default: 0s) [$PLUGIN_TIMEOUT, $SCP_TIMEOUT]
|
* key_path - path of ssh private key
|
||||||
--command.timeout value, -T value command timeout (default: 1m0s) [$PLUGIN_COMMAND_TIMEOUT, $SSH_COMMAND_TIMEOUT]
|
* target - target path on the server
|
||||||
--key value, -k value ssh private key [$PLUGIN_KEY, $SCP_KEY, $SSH_KEY, $KEY]
|
* source - scp file list
|
||||||
--key-path value, -i value ssh private key path [$PLUGIN_KEY_PATH, $SCP_KEY_PATH, $SSH_KEY_PATH]
|
* rm - remove target folder before upload data
|
||||||
--target value, -t value Target path on the server [$PLUGIN_TARGET, $SCP_TARGET, $TARGET]
|
|
||||||
--source value, -s value scp file list [$PLUGIN_SOURCE, $SCP_SOURCE, $SOURCE]
|
|
||||||
--rm, -r remove target folder before upload data [$PLUGIN_RM, $SCP_RM, $RM]
|
|
||||||
--proxy.ssh-key value private ssh key of proxy [$PLUGIN_PROXY_SSH_KEY, $PLUGIN_PROXY_KEY, $PROXY_SSH_KEY, $PROXY_KEY]
|
|
||||||
--proxy.key-path value ssh private key path of proxy [$PLUGIN_PROXY_KEY_PATH, $PROXY_SSH_KEY_PATH]
|
|
||||||
--proxy.username value connect as user of proxy (default: "root") [$PLUGIN_PROXY_USERNAME, $PLUGIN_PROXY_USER, $PROXY_SSH_USERNAME, $PROXY_USERNAME]
|
|
||||||
--proxy.password value user password of proxy [$PLUGIN_PROXY_PASSWORD, $PROXY_SSH_PASSWORD, $PROXY_PASSWORD]
|
|
||||||
--proxy.host value connect to host of proxy [$PLUGIN_PROXY_HOST, $PROXY_SSH_HOST, $PROXY_HOST]
|
|
||||||
--proxy.port value connect to port of proxy (default: "22") [$PLUGIN_PROXY_PORT, $PROXY_SSH_PORT, $PROXY_PORT]
|
|
||||||
--proxy.timeout value proxy connection timeout (default: 0s) [$PLUGIN_PROXY_TIMEOUT, $PROXY_SSH_TIMEOUT]
|
|
||||||
--strip.components value Remove the specified number of leading path elements. (default: 0) [$PLUGIN_STRIP_COMPONENTS, $TAR_STRIP_COMPONENTS]
|
|
||||||
--tar.exec tar Alternative tar executable to on the dest host (default: "tar") [$PLUGIN_TAR_EXEC, $SCP_TAR_EXEC]
|
|
||||||
--debug remove target folder before upload data [$PLUGIN_DEBUG, $DEBUG]
|
|
||||||
```
|
|
||||||
|
|
||||||
## Secrets
|
|
||||||
|
|
||||||
* `PASSWORD` - ssh server password
|
|
||||||
* `KEY` - ssh server private key
|
|
||||||
|
@ -19,7 +19,7 @@ inputs:
|
|||||||
key_path:
|
key_path:
|
||||||
description: 'path of ssh private key'
|
description: 'path of ssh private key'
|
||||||
target:
|
target:
|
||||||
description: 'Target path on the server'
|
description: 'target path on the server'
|
||||||
source:
|
source:
|
||||||
description: 'scp file list'
|
description: 'scp file list'
|
||||||
rm:
|
rm:
|
||||||
|
Loading…
Reference in New Issue
Block a user