Skip to content

Instantly share code, notes, and snippets.

@sb39
Last active October 15, 2020 05:58
Show Gist options
  • Save sb39/ab618c092504c30fcc8c5d04e04dbd34 to your computer and use it in GitHub Desktop.
Save sb39/ab618c092504c30fcc8c5d04e04dbd34 to your computer and use it in GitHub Desktop.
deploy react app to gitlab pages
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

Steps to follow -

  1. Make a .gitlab-ci.yml file in the root of your project
  2. Copy the contents of the file mentioned below to your file
  3. Populate the homepage field in package.json to include the relative routing of the gitlab endpoint
// Include this field in your package.json
{
"homepage": "[GITLAB_HOSTNAME/PROJECT_NAME]",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment