Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Host static website with GitLab pages

I need to host a static website with gitlab pages. My repo is a private repository (or project) and the .gitlab-ci.yml that I tried to use looks like this:

image: gpecchio:BeCall
pages:
  stage: deploy
  script:
  - echo 'Nothing to do...'
  artifacts:
    paths:
    - private
  only:
  - master

I believe that the image is wrong but I have no idea about what to change it to. I did some research but there aren't that many tutorials online for GitLab pages. How could I change this file to make it work?

Other info that might be useful:
GitLab username: gpecchio
GitLab project name: BeCall
GitLab project url: https://gitlab.com/gpecchio/BeCall

like image 422
GPecchio Avatar asked Jul 12 '17 07:07

GPecchio


People also ask

Are GitLab pages free?

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

What GitLab feature allows you to publish static websites directly from a repository in GitLab?

With GitLab Pages, you can publish static websites directly from a repository in GitLab. Use for any personal or business website.


1 Answers

Is your website created in html or are you using a static generator to create your website and then using gitlab pages to host it?

In the .gitlab-ci.yml file, the artifacts need to be public (even if your repository is private) for hosting your website using gitlab pages.

Here are some examples of what your .gitlab-ci.yml file needs to look like for hosting your site with gitlab pages.

HTML

pages:
  stage: deploy
  script:
  - mkdir .public
  - cp -r * .public
  - mv .public public
  artifacts:
    paths:
    - public
  only:
  - master

Jekyll

image: ruby:2.3

pages:
  stage: deploy
  script:
  - gem install jekyll
  - jekyll build -d public/
  artifacts:
    paths:
    - public
  only:
  - master

Hexo

image: node:4.2.2

pages:
  cache:
    paths:
    - node_modules/

  script:
  - npm install hexo-cli -g
  - npm install
  - hexo deploy
  artifacts:
    paths:
    - public
  only:
  - master

You should check out https://gitlab.com/pages/ which has examples of static sites created using all the different static site generator and hosted using gitlab pages.

You can also find some Jekyll themes hosted on gitlab pages at https://gitlab.com/groups/jekyll-themes

Finally, the link to your gitlab project url: https://gitlab.com/gpecchio/BeCall is private.

like image 113
Ishan Avatar answered Oct 20 '22 05:10

Ishan