Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jtbonhomme/d3c94d348d89a65b6e80055a03f80d7a to your computer and use it in GitHub Desktop.
Save jtbonhomme/d3c94d348d89a65b6e80055a03f80d7a to your computer and use it in GitHub Desktop.
Deploying to GitLab Pages (on each push)

(assuming project is hosted on GitLab)

  1. Enable shared runners by going to "Settings" > "Runners".
  2. Add .gitlab-ci.yml with the following content:
image: node:6.9.1
pages: 
  artifacts: 
    paths: 
      - build
  cache: 
    paths: 
      - .yarn-cache/
  only: 
    - master
  script: 
    - curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.19.1
    - export PATH="$HOME/.yarn/bin:$PATH"
    - yarn config set cache-folder $(pwd)/.yarn-cache
    - yarn install
    - yarn build
  stage: deploy

Your website will be available at https://username.gitlab.io/projectname.
If you want the URL to look like https://username.gitlab.io, go to your project's Settings and rename your project to username.gitlab.io.

To learn more about GitLab Pages go to https://pages.gitlab.io (official documentation available at http://doc.gitlab.com/ee/pages/README.html).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment