[
  {
    "path": "Dockerfile",
    "content": "FROM drinternet/rsync:v1.4.3\n\n\n# Label\nLABEL \"com.github.actions.name\"=\"rsync deployments\"\nLABEL \"com.github.actions.description\"=\"Quick and simple method of deploying code to a webserver via rsync over ssh\"\nLABEL \"com.github.actions.icon\"=\"truck\"\nLABEL \"com.github.actions.color\"=\"yellow\"\n\nLABEL \"repository\"=\"http://github.com/contention/rsync-deployments\"\nLABEL \"homepage\"=\"https://github.com/contention/rsync-deployments\"\nLABEL \"maintainer\"=\"Contention <hello@contention.agency>\"\n\n\n# Copy entrypoint\nADD entrypoint.sh /entrypoint.sh\nRUN chmod +x /entrypoint.sh\nENTRYPOINT [\"/entrypoint.sh\"]\n\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2019 Contention\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# rsync deployments\n\nThis GitHub Action deploys files in `GITHUB_WORKSPACE` to a folder on a server via rsync over ssh. \n\nThis action would usually follow a build/test action which leaves deployable code in `GITHUB_WORKSPACE`.\n\n# Required secrets\n\nThis action needs a `DEPLOY_KEY` secret variable. This should be the private key part of an ssh key pair. The public key part should be added to the authorized_keys file on the server that receives the deployment.\n\n# Required inputs\n\nThis action requires six inputs:\n\n1. `FLAGS` for any initial/required rsync flags, eg: `-avzr --delete`\n\n2. `EXCLUDES` for any `--exclude` flags and directory pairs, eg: `--exclude .htaccess --exclude /uploads/`. Use `\"\"` if none required.\n\n3. `USER` for the server user, eg: `deploybot`\n\n4. `HOST` for the deployment target, eg: `myserver.com`\n\n5. `LOCALPATH` for the local path to sync, eg: `/dist/`\n\n5. `REMOTEPATH` for the remote path to sync, eg: `/srv/myapp/public/htdocs/`\n\n# Example usage\n\n```\nname: Deploy to production\n\non:\n  push:\n    branches:\n      - master\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: contention/rsync-deployments@v2.0.0\n        with:\n          FLAGS: -avzr --delete\n          EXCLUDES: --exclude .htaccess --exclude /uploads/\n          USER deploybot\n          HOST: myserver.com\n          LOCALPATH: /dist/\n          REMOTEPATH: /srv/myapp/public/htdocs/\n          DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}\n\n```\n\n## REMINDER! \n\nCheck your keys. Check your deployment paths. Check your flags. And use at your own risk.\n"
  },
  {
    "path": "action.yml",
    "content": "name: 'rsync deployments'\ndescription: 'Quick and simple method of deploying code to a webserver via rsync over ssh'\nauthor: 'Contention'\ninputs:\n  flags:\n    description: 'Initial/required rsync flags'\n    required: true\n  excludes:\n    description: 'Exclude flags and directory pairs'\n    required: true\n  user:\n    description: 'The server user'\n    required: true\n  host:\n    description: 'The deployment target'\n    required: true\n  localpath:\n    description: 'The local path to sync'\n    required: true\n  remotepath:\n    description: 'The remote path to sync'\n    required: true\n  deploy_key:\n    description: 'The private key'\n    required: true\nruns:\n  using: 'docker'\n  image: 'Dockerfile'\nbranding:\n  icon: 'truck'  \n  color: 'yellow'\n"
  },
  {
    "path": "entrypoint.sh",
    "content": "#!/bin/sh\n\nset -eu\n\n# Set deploy key\nSSH_PATH=\"$HOME/.ssh\"\nmkdir \"$SSH_PATH\"\necho \"$INPUT_DEPLOY_KEY\" > \"$SSH_PATH/deploy_key\"\nchmod 600 \"$SSH_PATH/deploy_key\"\n\n\n# Do deployment\nsh -c \"rsync $INPUT_FLAGS -e 'ssh -i $SSH_PATH/deploy_key -o StrictHostKeyChecking=no' $INPUT_EXCLUDES $GITHUB_WORKSPACE/$INPUT_LOCALPATH $INPUT_USER@$INPUT_HOST:$INPUT_REMOTEPATH\"\n"
  }
]