name: Deploy to VPS

on:
  push:
    branches: [main]
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    concurrency:
      group: deploy-bigscreen10
      cancel-in-progress: false

    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Rsync timeline/ to /var/www/bigscreen10
        uses: easingthemes/ssh-deploy@v5.0.0
        with:
          SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
          REMOTE_HOST: ${{ secrets.SSH_HOST }}
          REMOTE_USER: ${{ secrets.SSH_USER }}
          REMOTE_PORT: ${{ secrets.SSH_PORT || '22' }}
          SOURCE: 'timeline/'
          TARGET: '/var/www/bigscreen10/'
          # -r recursive, -l symlinks, -t times, -g group, -o owner,
          # -D devices+specials, -z compress, -v verbose, -O omit dir times,
          # --delete drops files that no longer exist locally,
          # --exclude protects server-managed files we don't want overwritten
          ARGS: '-rltgoDzvO --delete --exclude=.htpasswd --exclude=.well-known --exclude=img/beyond-trailer.mp4'
