Giter Club home page Giter Club logo

rsync's Introduction

GitHub Action to Deploy via rsync over ssh

Actions Status GitHubActions

Sometimes, you might want to deploy 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 and advises against usage in production.

This action in particular requires ssh private keys (see secrets), and may thus be vulnerable. The ssh authentification may need improvement (see issues).

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 deploy to.

Remember to never commit these keys, but provide them to the GitHub UI (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.

  • 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.

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"
  ]
}

rsync's People

Contributors

maxheld83 avatar bianchimro avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.