name: ci-cd

on:
  pull_request:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    if: github.ref == 'refs/heads/main'
    steps:
      - uses: actions/checkout@v2 
        with:
          fetch-depth: 0
      - name: deploy to dokku instance
        uses: idoberko2/dokku-deploy-github-action@v1
        with:
          ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
          dokku-host: 'planner.thermokar.st'
          app-name: 'webapp'
          remote-branch: 'main'
          # Keeping the following around, in case of emergencies:
          # git-push-flags: --force