GitLab 页面,使用 sphinx 生成的文档

标签 gitlab python-sphinx gitlab-ci

我想在 GitLab 页面上托管使用 Sphinx 生成的静态页面。已建 index.html文件在:

project/docs/build/html

如何.gitlab-ci.yml应该看起来像部署页面?我有类似的东西,但它不起作用:
pages:
  stage: deploy
  script:
  - echo 'Nothing to do...'
 artifacts:
 paths:
 - docs/build/html
 only:
 - master

最佳答案

根据documentation for .gitlab-ci.yml , pages工作有它必须遵循的特殊规则:

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


所以例子.gitlab-ci.yml你给的看起来像这样:
pages:
  stage: deploy
  script:
    - mv docs/build/html/ public/
  artifacts:
    paths:
    - public
  only:
  - master

当然,如果您不想移动 html无论出于何种原因,您都可以复制它。

如需进一步引用,an example sphinx project for GitLab Pages在您最初发布此问题时被推送。

关于GitLab 页面,使用 sphinx 生成的文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48223039/

相关文章:

Python sphinx 自动摘要错误

python - 狮身人面像自动模块 : how to reference classes in same module?

GitLab-CI:仅在满足所有条件时才运行作业

jenkins - 有没有办法在 Jenkins 中获取 Gitlab 管道工件?

GitLab CI/CD 管道,部署到 Windows Server

python - 如何使 Python/Sphinx 文档对象属性仅在 __init__ 中声明?

maven - GitLab CI 如何在maven多模块项目中触发子模块的管道

gradle - 使用kaniko时无法在build.gradle UPD中访问gitlab-ci环境变量

gitlab - 我可以恢复已删除分支的 GitLab 合并请求吗?

GitLab Runner 没有运行特权