name: Docs Full Rebuild (dpp.dev)
on:
  release:
    types: [published]
  workflow_dispatch:

permissions:
  contents: read

jobs:
  docs:
    permissions:
      contents: write # Needs to be able to write to the repo.
    name: Rebuild all Documentation
    runs-on: ubuntu-24.04

    concurrency: 
      group: docs-deployment
      cancel-in-progress: true

    steps:
      - name: Harden Runner
        uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
        with:
          egress-policy: audit

      - name: Setup PHP
        uses: shivammathur/setup-php@7c071dfe9dc99bdf297fa79cb49ea005b9fcadbc # v2.37.1
        with:
          php-version: '8.3'

      - name: Checkout D++
        uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
        with:
          submodules: recursive

      - name: Generate Docs
        run: cd docpages && php makedocs-gh.php rebuild-old
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
