Generating Gitlab Pages Using Sphinx

  1. Create file .gitlab-ci.yml at the root of the repository with the following contents.

    image: python:3.7-alpine
    
    pages:
    script:
    - pip install -U sphinx
    - pip install sphinx_rtd_theme
    - sphinx-build -d _build/doctrees docs/source _build/html
    - mv _build/html public
    artifacts:
        paths:
        - public
    only:
    - master
    
  2. In the code above, change docs/source to the directory that contains sphinx’s conf.py.

  3. Once committed and pushed, a success run should show up in CI/CD -> Pipelines. See image below.

CI/CD - Pipeline snapshot

References:

Avatar
Luke Sy
PhD Candidate

My research interests include state estimation, robotics, wearable sensors, machine learning, and biomedical engineering.

Next
Previous