Steps to follow -
- Make a .gitlab-ci.yml file in the root of your project
- Copy the contents of the file mentioned below to your file
- Populate the homepage field in package.json to include the relative routing of the gitlab endpoint
image: node:latest | |
stages: | |
- build | |
- deploy | |
cache: | |
paths: | |
- node_modules/ | |
build: | |
stage: build | |
script: | |
- yarn build | |
pages: | |
stage: deploy | |
script: | |
- yarn build | |
- rm -rf public | |
- mv build public | |
artifacts: | |
paths: | |
- public | |
only: | |
- master |
// Include this field in your package.json | |
{ | |
"homepage": "[GITLAB_HOSTNAME/PROJECT_NAME]", | |
} |