Commit c9b63ee4 authored by Achilleas Pipinellis's avatar Achilleas Pipinellis Committed by James Edwards-Jones

Add pages job in yaml document

parent 8f7eb4e3
...@@ -1281,6 +1281,35 @@ with an API call. ...@@ -1281,6 +1281,35 @@ with an API call.
[Read more in the triggers documentation.](../triggers/README.md) [Read more in the triggers documentation.](../triggers/README.md)
### pages
`pages` is a special job that is used to upload static content to GitLab that
can be used to serve your website. It has a special syntax, so the two
requirements below must be met:
1. Any static content must be placed under a `public/` directory
1. `artifacts` with a path to the `public/` directory must be defined
The example below simply moves all files from the root of the project to the
`public/` directory. The `.public` workaround is so `cp` doesn't also copy
`public/` to itself in an infinite loop:
```
pages:
stage: deploy
script:
- mkdir .public
- cp -r * .public
- mv .public public
artifacts:
paths:
- public
only:
- master
```
Read more on [GitLab Pages user documentation](../../pages/README.md).
## Validate the .gitlab-ci.yml ## Validate the .gitlab-ci.yml
Each instance of GitLab CI has an embedded debug tool called Lint. Each instance of GitLab CI has an embedded debug tool called Lint.
......
...@@ -64,7 +64,7 @@ In brief, this is what you need to upload your website in GitLab Pages: ...@@ -64,7 +64,7 @@ In brief, this is what you need to upload your website in GitLab Pages:
(ask your administrator). This is very important, so you should first make (ask your administrator). This is very important, so you should first make
sure you get that right. sure you get that right.
1. Create a project 1. Create a project
1. Provide a specific job named [`pages`](../ci/yaml/README.md#pages) in 1. Provide a specific job named [`pages`][pages] in
[`.gitlab-ci.yml`](../ci/yaml/README.md) [`.gitlab-ci.yml`](../ci/yaml/README.md)
1. A GitLab Runner to build GitLab Pages 1. A GitLab Runner to build GitLab Pages
...@@ -112,7 +112,7 @@ access it under `http(s)://groupname.example.io`. ...@@ -112,7 +112,7 @@ access it under `http(s)://groupname.example.io`.
To make use of GitLab Pages, your `.gitlab-ci.yml` must follow the rules below: To make use of GitLab Pages, your `.gitlab-ci.yml` must follow the rules below:
1. A special `pages` job must be defined 1. A special [`pages`][pages] job must be defined
1. Any static content must be placed under a `public/` directory 1. Any static content must be placed under a `public/` directory
1. `artifacts` with a path to the `public/` directory must be defined 1. `artifacts` with a path to the `public/` directory must be defined
...@@ -222,3 +222,4 @@ to private, internal or public. ...@@ -222,3 +222,4 @@ to private, internal or public.
[pages-daemon]: https://gitlab.com/gitlab-org/gitlab-pages [pages-daemon]: https://gitlab.com/gitlab-org/gitlab-pages
[gitlab ci]: https://about.gitlab.com/gitlab-ci [gitlab ci]: https://about.gitlab.com/gitlab-ci
[gitlab runner]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner [gitlab runner]: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
[pages]: ../ci/yaml/README.md#pages
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment