# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) Contributors to the OpenEXR Project.
#
# GitHub Actions workflow file
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions

name: Website

# Run only on changes in the "website" directory or workflow file.
# Skip the release branches, since the website is built from main.

on:

  push:
    branches:-ignore:
      - RB-*
    paths:
      - 'website/**'
      - '.github/workflows/website_workflow.yml'
      
  pull_request:
    branches:-ignore:
      - RB-*
    paths:
      - 'website/**'
      - '.github/workflows/website_workflow.yml'

permissions:
  contents: read

jobs:

  Website:

    # Build the website, using a process that mimics the readthedoc build.
    
    name: 'Website'
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout
        uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - name: Create build directory
        run: mkdir _build
      - name: Install doxygen 
        run: sudo apt-get install -y doxygen
      - name: Install sphinx requirements
        run: pip3 install -r website/requirements.txt
      - name: Configure
        run: cmake .. -DBUILD_WEBSITE='ON'
        working-directory: _build
      - name: Build
        run: |
          cmake --build . \
                --target website \
                --config Release
        working-directory: _build
    
