48 lines
1.4 KiB
Markdown
48 lines
1.4 KiB
Markdown
# Rsync action
|
|
|
|
This action sends the contents of a directory to a remote server using [rsync][rsync].
|
|
|
|
## Usage
|
|
|
|
Basic usage:
|
|
|
|
```yaml
|
|
- name: Transfer files
|
|
uses: https://git.pvv.ntnu.no/oysteikt/rsync-action@v1
|
|
with:
|
|
source: ./path/to/directory/
|
|
target: /path/at/remote/
|
|
username: username
|
|
host: hostname
|
|
ssh-key: ${{ secrets.SSH_KEY }}
|
|
```
|
|
|
|
Advanced usage:
|
|
|
|
```yaml
|
|
- name: Transfer files
|
|
uses: https://git.pvv.ntnu.no/oysteikt/rsync-action@v1
|
|
with:
|
|
source: ./path/to/directory/
|
|
target: /path/at/remote/
|
|
username: username
|
|
host: hostname
|
|
port: 2222
|
|
ssh-key: ${{ secrets.SSH_KEY }}
|
|
args: -avz --mkpath --exclude 'node_modules' --delete
|
|
known-hosts-content: "[hostname]:2222 ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
```
|
|
|
|
## Recommended setup on the remote server
|
|
|
|
To force the action to only write to a specific directory,
|
|
and to prevent excessive damage should the SSH key be compromised,
|
|
it is recommended to force the command in the `authorized_keys` file.
|
|
|
|
```shell
|
|
command="rrsync -wo /directory/to/write/to",restrict,no-agent-forwarding,no-port-forwarding,no-pty,no-X11-forwarding ssh-ed25519 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
|
```
|
|
|
|
The path specified in `target` will now be relative to `/directory/to/write/to`.
|
|
|
|
[rsync]: https://rsync.samba.org/ |