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
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.
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.
With GitLab Pages you can host your static website for free.
According to the documentation for .gitlab-ci.yml, the pages
job has special rules it must follow:
- Any static content must be placed under a
public/
directoryartifacts
with a path to thepublic/
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With