name: Docs
on:
  push:
    branches:
      - master
permissions: {}
jobs:
  build_and_publish:
    permissions:
      contents: write # to push changes in repo (jamesives/github-pages-deploy-action)

    name: Build and publish Docs
    runs-on: ubuntu-latest
    if: github.repository == 'PHPMailer/PHPMailer'
    steps:
      - name: Checkout sources
        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
        with:
          fetch-depth: 1
          persist-credentials: false
      - name: Build Docs
        uses: ./.github/actions/build-docs
      - name: Publish Docs to gh-pages
        uses: JamesIves/github-pages-deploy-action@9d877eea73427180ae43cf98e8914934fe157a1a # v4.7.6
        with:
          branch: gh-pages
          folder: docs
        env:
          BUILD_DIR: docs/
          GH_PAT: ${{ secrets.GH_PAT }}
