Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pxdsgnco/5b29563dec6e88e8689b1a9752b37aea to your computer and use it in GitHub Desktop.
Save pxdsgnco/5b29563dec6e88e8689b1a9752b37aea 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