GitLab Pages, docs generated with sphinx

萝らか妹 提交于 2019-12-21 10:15:50

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/48223039/gitlab-pages-docs-generated-with-sphinx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!