name: Deploy Prod

# Runs after Unit Tests completes on master. Direct pushes only (not PRs).
on:
  workflow_run:
    workflows: [Unit Tests]
    types: [completed]
    branches: [master]

jobs:
  deploy:
    if: gitea.event.workflow_run.conclusion == 'success' && gitea.event.workflow_run.event == 'push'
    runs-on: self-hosted
    env:
      SERVER_INFRA_ROOT: /home/westfarn/Documents/repos/server-infra
    steps:
      - name: Deploy chat_web_app prod
        run: |
          "$SERVER_INFRA_ROOT/scripts/deploy.sh" \
            --app chat_web_app \
            --env prod \
            --ref "${{ gitea.event.workflow_run.head_sha }}"
