GitLab Pages, docs generated with sphinx

gitlabgitlab-cipython-sphinx

I want to host static page generated with Sphinx on GitLab Pages. Built index.html file is in:

project/docs/build/html

How .gitlab-ci.yml should look like to deploy the page? I have something like that and it isn't working:

pages:
  stage: deploy
  script:
  - echo 'Nothing to do...'
 artifacts:
 paths:
 - docs/build/html
 only:
 - master

Best Answer

According to the documentation for .gitlab-ci.yml, the pages job has special rules it must follow:

  1. Any static content must be placed under a public/ directory
  2. artifacts with a path to the public/ directory must be defined

So the example .gitlab-ci.yml you gave would look something like this:

pages:
  stage: deploy
  script:
    - mv docs/build/html/ public/
  artifacts:
    paths:
    - public
  only:
  - master

And of course, if you don't want to move the html folder for whatever reason, you can copy it instead.

For further reference, an example sphinx project for GitLab Pages was pushed around the time you originally posted this question.

Related Topic