Git Repository Deploy to VPS empty Directory

Viewed 37

I'm trying to have my Git Repository deploy to my VPS whenever push to the master branch. Right now I have this GitHub Workflow setup below. Everything is connecting and seemingly works, however it creates an empty folder and doesn't clone or pull.

Should I use a different Action, or am I doing something wrong that you can see? I'm not sure how to debug this because I just learned it today :)

name: Deploy to Production
on:
  push:
    branches:
      - master
jobs:
  deploy-to-server:
    runs-on: ubuntu-latest
    steps:
      - name: Deploy to Server
        uses: easingthemes/ssh-deploy@main
        env:
          SSH_PRIVATE_KEY: ${{ secrets.SERVER_SSH_KEY }}
          REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
          REMOTE_USER: ${{ secrets.REMOTE_USER }}
          REMOTE_PORT: ${{ secrets.REMOTE_PORT }}
          TARGET: ${{ secrets.REMOTE_TARGET }}
      - name: Dump GitHub context
        env:
          GITHUB_CONTEXT: ${{ toJson(github) }}
        run: echo "$GITHUB_CONTEXT"

My output from the first step for SSH is:

Run easingthemes/ssh-***@main
[general] GITHUB_WORKSPACE:  /home/runner/work/test/test
[SSH] Creating /home/runner/.ssh dir in  /home/runner/work/test/test
✅ [SSH] dir created.
[SSH] Creating /home/runner/.ssh/known_hosts file in  /home/runner/work/test/test
✅ [SSH] file created.
✅ Ssh key added to `.ssh` dir  /home/runner/.ssh/***_key
[Rsync] Starting Rsync Action: /home/runner/work/test/test/ to ***@***:***
[Rsync] exluding folders 
✅ [Rsync] finished. sending incremental file list
./

sent 58 bytes  received 19 bytes  51.33 bytes/sec
total size is 0  speedup is 0.00
1 Answers

Check first if this is similar to easingthemes/ssh-deploy issue 30:

I forgot to checkout my code first .
I just added - uses: actions/checkout@main right under the line that says - name: ssh deploy.

In your case:

jobs:
  deploy-to-server:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code first
        uses: actions/checkout@main
      - name: Deploy to Server
        uses: easingthemes/ssh-deploy@main
Related