Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maxheld83/rsync
In the process of being transitioned to a node.js action.
https://github.com/maxheld83/rsync
bash bash-script deployment github-action github-actions rsync ssh
Last synced: 2 days ago
JSON representation
In the process of being transitioned to a node.js action.
- Host: GitHub
- URL: https://github.com/maxheld83/rsync
- Owner: maxheld83
- License: mit
- Created: 2019-01-27T09:14:19.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-14T16:36:45.000Z (over 5 years ago)
- Last Synced: 2024-08-16T06:01:17.846Z (3 months ago)
- Topics: bash, bash-script, deployment, github-action, github-actions, rsync, ssh
- Language: Shell
- Homepage: https://www.maxheld.de/rsync/
- Size: 33.2 KB
- Stars: 53
- Watchers: 3
- Forks: 12
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Action for Deploying via `rsync` Over `ssh`
[![Actions Status](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/badge/maxheld83/rsync)](https://github.com/maxheld83/rsync/actions)
[![GitHubActions](https://img.shields.io/badge/as%20seen%20on%20-GitHubActions-blue.svg)](https://github-actions.netlify.com/rsync)
[![View Action](https://img.shields.io/badge/view-action-blue.svg)](https://github.com/marketplace/actions/rsync-deploy)Sometimes, you might want to use `rsync` inside GitHub actions, such as for deploying static assets to some old school webserver over ssh.
This is your action.It allows you to transfer files *from* your working directory (`/github/workspace`) *to* some server using `rsync` over `ssh`.
Helpfully, `/github/workspace` includes a copy of your repository *source*, as well as any build artefacts left behind by previous workflow steps (= other actions you ran before).## Disclaimer
GitHub actions is still [in limited public beta](https://github.com/features/actions) and advises against [usage in production](https://developer.github.com/actions/).
This action requires ssh private keys (see secrets), and **may thus be vulnerable**.
The ssh authentification **may need improvement** (see [issues](https://github.com/maxheld83/rsync/)).## Secrets
This action requires two secrets to authenticate over ssh:
- `SSH_PRIVATE_KEY`
- `SSH_PUBLIC_KEY`You get both of these from the server you interact with.
Remember to never commit these keys, but [provide them through the GitHub UI](https://developer.github.com/actions/creating-workflows/storing-secrets/) (repository settings/secrets).
## Environment Variables
This action requires three environment variables used to register the target server in `$HOME/.ssh/known_hosts`.
This is to make sure that the action is talking to a trusted server.**`known_hosts` verification currently fails and is overriden, see [issue 1](https://github.com/maxheld83/rsync/issues/1)**.
- `HOST_NAME` (the name of the server you wish to deploy to, such as `foo.example.com`)
- `HOST_IP` (the IP of the server you wish to deploy to, such as `111.111.11.111`)
- `HOST_FINGERPRINT` (the fingerprint of the server you wish to deploy to, can have different formats)The `HOST_NAME` is *also* used in the below required arguments.
## Required Arguments
`rsync` requires:
- `SRC`: source directory, relative path *from* `/github/workspace`
- `[USER@]HOST::DEST`: target user (optional), target server, and directory from root *on* that target server.
Remember you can reuse the environment variable `$HOST_NAME`.For action `rsync` options, see `entrypoint.sh` in the source.
For more options and documentation on `rsync`, see [https://rsync.samba.org](https://rsync.samba.org).## Example Usage
```
action "Deploy with rsync" {
uses = "maxheld83/[email protected]"
needs = "Write sha"
secrets = [
"SSH_PRIVATE_KEY",
"SSH_PUBLIC_KEY"
]
env = {
HOST_NAME = "foo.example.com"
HOST_IP = "111.111.11.111"
HOST_FINGERPRINT = "ecdsa-sha2-nistp256 AAAA..."
}
args = [
"$GITHUB_WORKSPACE/index.html",
"alice@$HOST_NAME:path/to/destination"
]
}
```