2019-05-11 17:01:31 +08:00
|
|
|
# 🚀 SCP for GitHub Actions
|
|
|
|
|
|
|
|
[GitHub Action](https://developer.github.com/actions/) for copying files and artifacts via SSH.
|
|
|
|
|
2019-05-11 17:04:21 +08:00
|
|
|
<img src="./images/copy-multiple-file.png">
|
2019-05-11 17:01:31 +08:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
copy files and artifacts via SSH as blow.
|
|
|
|
|
|
|
|
```
|
|
|
|
action "Copy multiple file" {
|
|
|
|
uses = "appleboy/scp-action@master"
|
|
|
|
env = {
|
|
|
|
HOST = "example.com"
|
|
|
|
USERNAME = "foo"
|
|
|
|
PASSWORD = "bar"
|
|
|
|
PORT = "22"
|
|
|
|
SOURCE = "tests/a.txt,tests/b.txt"
|
|
|
|
TARGET = "/home/foo/test"
|
|
|
|
}
|
|
|
|
secrets = [
|
|
|
|
"PASSWORD",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2019-05-11 19:49:38 +08:00
|
|
|
## Environment variables
|
|
|
|
|
|
|
|
* HOST - ssh server host
|
|
|
|
* PORT - ssh server port
|
|
|
|
* USERNAME - ssh server username
|
|
|
|
* PASSWORD - ssh server password
|
|
|
|
* KEY - ssh server private key
|
|
|
|
* TARGET - target folder
|
|
|
|
* SOURCE - scp file list
|
|
|
|
|
2019-05-11 17:01:31 +08:00
|
|
|
### Example
|
|
|
|
|
2019-05-11 19:49:38 +08:00
|
|
|
Copy file via ssh password
|
|
|
|
|
2019-05-11 17:01:31 +08:00
|
|
|
```
|
|
|
|
action "Copy multiple file" {
|
|
|
|
uses = "appleboy/scp-action@master"
|
|
|
|
env = {
|
|
|
|
HOST = "example.com"
|
|
|
|
USERNAME = "foo"
|
|
|
|
PORT = "22"
|
|
|
|
SOURCE = "tests/a.txt,tests/b.txt"
|
|
|
|
TARGET = "/home/foo/test"
|
|
|
|
}
|
|
|
|
secrets = [
|
|
|
|
"PASSWORD",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
2019-05-11 19:49:38 +08:00
|
|
|
|
|
|
|
Copy file via ssh key
|
|
|
|
|
|
|
|
```
|
|
|
|
action "Copy file via ssh key" {
|
|
|
|
uses = "appleboy/scp-action@master"
|
|
|
|
env = {
|
|
|
|
HOST = "example.com"
|
|
|
|
USERNAME = "foo"
|
|
|
|
PORT = "22"
|
|
|
|
SOURCE = "tests/c.txt,tests/d.txt"
|
|
|
|
TARGET = "/home/actions/test"
|
|
|
|
}
|
|
|
|
secrets = [
|
|
|
|
"KEY",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
Example configuration for ignore list:
|
|
|
|
|
|
|
|
```
|
|
|
|
action "reqular expression list" {
|
|
|
|
uses = "appleboy/scp-action@master"
|
|
|
|
env = {
|
|
|
|
HOST = "example.com"
|
|
|
|
USERNAME = "foo"
|
|
|
|
PORT = "22"
|
|
|
|
SOURCE = "tests/*.txt,!tests/a.txt"
|
|
|
|
TARGET = "/home/actions/test"
|
|
|
|
}
|
|
|
|
secrets = [
|
|
|
|
"KEY",
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Secrets
|
|
|
|
|
|
|
|
* `PASSWORD` - ssh server password
|
|
|
|
* `KEY` - ssh server private key
|