简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM