build_docs:
  stage: docs
  image: python:3.12
  before_script:
    - apt-get update
    - apt-get install -y graphviz
    - python -m venv venv
    - source venv/bin/activate
    - pip install --upgrade pip
    - pip install sphinx sphinx_bootstrap_theme pyyaml typing-extensions colorama
    - pip install extension sphinx_autodoc_typehints sphinxcontrib.plantuml sphinxcontrib.mermaid
    - pip install dist/*.whl
    - pip install build
  script:
    - echo "*** Building Sphinx docs... "
    - cd docs && make html
    - cd ..
    - echo "*** Docs built ***"
  artifacts:
    paths:
      - public
    expire_in: 1 week


pages:
  stage: deploy
  dependencies:
    - build_docs
  script:
    - echo "*** Deploying Sphinx docs to GitLab Pages... ***"
    - pwd
    - ls -la public  # Verify that the public folder is there before uploading
  artifacts:
    paths:
      - public
  only:
    - master  # Deploy only from the default branch

