Search code examples
github-actionscygwinrsync

Is rsync to Windows supported by GitHub actions?


I'm trying to deploy a .Net Core application via GitHub actions from an ubuntu runner to a Windows Server 2022 machine using rsync (not ideal, I'm aware), and it's been giving me quite a bit of trouble so I'm wondering if this admittedly-nonstandard workflow is even supported. Documentation on GitHub actions seems to be decentralized by design.

This is my current yml for the workflow:

jobs:
  publish:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v4
      - name: Setup dotnet 8
        uses: actions/setup-dotnet@v3
        with:
          dotnet-version: 8.0.x
      <do some pre-deploy stuff>
      - name: rsync test
        working-directory: my/project/bin
        run: rsync -e "ssh -i my_edcsa.pem -p 55297 -o StrictHostKeyChecking=no" publish/wwwroot my-username@${{ secrets.SERVER }}:/cygdrive/c/project/destination

I have cygwin with rsync installed on the server machine, ssh keys setup, and all that seems to be operating correctly.

Yet I'm getting a "directory not found" error from the windows side, because it seems like rsync is tacking on some very strange extra directories like so:

rsync: [Receiver] change_dir#3 "/cygdrive/c/Users/my-username/C:/Program Files/Git/cygdrive/c/project/destination" failed: No such file or directory (2)

I understand this is not the ideal setup for any sort of .Net deploy, but we're dealing with a very old-school client that had to be convinced to even use Git and allow remote deployments in general. So, I'm working with what I've got so far.


Solution

  • After some research today, the issue was an existing installation of Git-Bash on the remote windows machine conflicting with the new installation of cygwin. My solution was to install rsync directly into Git-Bash environment and forgo cygwin altogether. Basically following the instructions found here: https://stackoverflow.com/a/76843477/4556955

    My final rsync command wound up having this format:

    rsync -r -e "ssh -i my_edcsa.pem -p 55297 -o StrictHostKeyChecking=no" publish/wwwroot my-username@${{ secrets.SERVER_HOST_STAGE }}:/c/project/destination