---
name: CI - Main daily

on:
  workflow_dispatch:
  schedule:
    # Every night at 3am
    - cron: "0 3 * * *"
  pull_request:
    paths:
      # Needs to refer to itself
      - .github/workflows/ci-main-daily.yml

jobs:
  test-container:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        version:
          - docs
          - version-2025-12
          - version-2026-2
    steps:
      - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v5
      - run: |
          set -euo pipefail
          current="$(pwd)"
          dir="/tmp/authentik/${{ matrix.version }}"
          # 2025.12 still serves the legacy docker-compose filename; newer sites use compose.yml.
          compose_path="compose.yml"
          if [ "${{ matrix.version }}" = "version-2025-12" ]; then
            compose_path="docker-compose.yml"
          fi
          mkdir -p "${dir}/lifecycle/container"
          cd "${dir}"
          wget "https://${{ matrix.version }}.goauthentik.io/${compose_path}" -O "${dir}/lifecycle/container/compose.yml"
          "${current}/scripts/test_docker.sh"
