Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab Pages, docs generated with 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
like image 852
meller92 Avatar asked Jan 12 '18 09:01

meller92


People also ask

What is my GitLab pages URL?

Your project's URL is https://gitlab.com/websites/websites.gitlab.io . Once you enable GitLab Pages for your project, your website is published under https://websites.gitlab.io . General example: On GitLab.com, a project site is always available under https://namespace.gitlab.io/project-name.

How do GitLab pages work?

GitLab always deploys your website from a specific folder called public in your repository. When you create a new project in GitLab, a repository becomes available automatically. To deploy your site, GitLab uses its built-in tool called GitLab CI/CD to build your site and publish it to the GitLab Pages server.

Are GitLab pages free?

With GitLab Pages you can host your static website for free.


1 Answers

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.

like image 105
systemexit Avatar answered Oct 18 '22 14:10

systemexit