This is how this blog runs :)
So each project you create on Gitlab can have its own pages, deployed depending rules you set in the Continuous Integration file, the
What you can do with Gitlab pages and gitlab-ci:
- build and test your application on each commit
- assure that every merge on master won’t break the build
- deploy a static website on a custom fqdn when building a branch
What you cannot do:
- review apps, a feature that allow you to deploy feature branches for review, are not supported yet for gitlab pages. If you want to review your static website, you will need to get your own server (I recommend 3$/month scaleway.com servers). But we will only see here what you can do without a credit card.
Create a new gitlab repository. Make it private or public, as you want.
Next you need to have some static content. I chose H.U.G.O. but it can be anything, even static html files.
So let’s imagine you have committed a
index.html at the root of your gitlab project, and you want to publish that.
<html> <body> <h1>Hello Pages World!</h1> </body> </html>
You would only have to add the
.gitlab-ci.yml file, describing a
pages job that contain an
artifact targeting the
pages: stage: deploy only: - master script: - echo deploying pages - mkdir public - cp index.html public/ artifacts: paths: - public
Gitlab will detect the name of the job,
pages, and will automatically deploy the content of the
If you go to your pipeline, you will see that a stage appeared:
And if you go to Settings -> Pages in your repository, you will see a message saying that your pages are deployed :
Just follow the link!
Next step : You can easily configure your pages to be on you custom fqdn. See the Gitlab Pages Documentation