Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example using the new YML syntax #2

Closed
RaduCStefanescu opened this issue Sep 16, 2019 · 6 comments
Closed

Example using the new YML syntax #2

RaduCStefanescu opened this issue Sep 16, 2019 · 6 comments

Comments

@RaduCStefanescu
Copy link

Hi, could you please provide an example about how to use rsync-deployments using the new YML syntax provided by Github Actions?

@thom4parisot
Copy link

I've proposed an attempt to do that in #7.

@pujianto
Copy link

pujianto commented Nov 6, 2019

- name: Deploy to Staging 
  uses: contention/rsync-deployments@v1.0.0
  env: 
    DEPLOY_KEY: ${{secrets.DEPLOY_KEY}} 
  with: 
    args: "-avzr --delete --exclude .htaccess --exclude /uploads/ user@server.com:/srv/myapp/public/htdocs/"

@jonathanhatch
Copy link

I'm still getting docker exiting with code 2 when it gets to the entrypoint.sh. Any thoughts?

@generator85
Copy link

generator85 commented Jan 18, 2020

It seems to work here, I get a full list of all the files and this after:

sent 250663 bytes received 56 bytes 167146.00 bytes/sec
total size is 37470734 speedup is 149.45

But no files appear at the receiving end. Any ideas what could cause this?

@pujianto
Copy link

@generator85 Make sure your destination server:/path captured in $3 variable in entrypoint.sh

@IlyaSemenov
Copy link

For whoever is landing up here, I recommend ditching the pre-made rsync actions and going either fully manually or use simpler helper like ssh-agent:

    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup SSH agent
        uses: webfactory/ssh-agent@v0.4.0
        with:
          ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
      - name: Setup known_hosts
        run: echo 'my.host.io ssh-rsa AAAAB3....+8U=' >> ~/.ssh/known_hosts
      - name: Sync project files
        run: rsync -avzr --delete ${GITHUB_WORKSPACE}/ user@my.host.io:/srv/files/

(you can generate the line for known_host with ssh-keyscan, or simply copy it from your own known_hosts)

The reasons being:

  1. Secure - you provide a specific SSH fingerprint, so the workflow will fail on MitM or DNS attacks (unlike this action, which runs with -o StrictHostKeyChecking=no)
  2. Simpler - you have full control over the rsync command without having to remember which action args go where

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants