name: Website Dev

on:
  push:
    branches: [dev]

defaults:
  run:
    working-directory: /opt/runner/workdir/gcg-website-dev

jobs:
  dev-build:
    name: Entwicklungsumgebung
    if: gitea.repository == 'gcg/gcg-website'
    runs-on: act-runner-user
    steps:
      - name: Pull
        run: |
          git fetch --all
          git reset --hard origin/dev
          git lfs pull
      - name: Build
        run: |
          rm -rf dev
          hugo --minify --gc --baseURL "https://dev.cantorgymnasium.de/" --buildDrafts --buildFuture -d dev
      - name: Deploy
        run: |
          cd dev
          pagefind_extended --site=. 
          rsync -azr --delete ./ /opt/data/webdata/gcg-website-dev/          
      - name: Notification
        uses: actions/telegram-action@main
        if: always()
        with:
          chat_id: ${{ secrets.TG_CHAT_ID }}
          token: ${{ secrets.TG_TOKEN }}