
name: Build Docs and Deploy Static Site
on:
  push:
    branches:
      - master

jobs:
  build-and-deploy:
    if: github.event.pull_request.merged == 'true'
    runs-on: windows-latest
    steps:
      - name: Checkout 🛎️
        uses: actions/checkout@v2
        with:
          persist-credentials: false

      - name: Setup Python
        uses: actions/setup-python@v2
        with:
          python-version: '3.8'

      - name: Install flit
        run: |
          python -m pip install flit

      - name: Install dependencies
        run: python -m flit install --deps develop --extras doc

      - name: Build Docs 🔧
        run: |
          pdoc3 --html cppcpyutils -o docs --force

      - name: Deploy 🚀
        uses: peaceiris/actions-gh-pages@v3.6.4
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          publish_branch: master
          publish_dir: docs

