From d0e3c8bfe670fde52040ccac474cb8a49c412def Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luca=20J=C3=A4ntsch?= Date: Fri, 24 May 2019 13:57:52 +0200 Subject: [PATCH] =?UTF-8?q?.gitlab-ci.yml=20hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitlab-ci.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..2f5250f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,30 @@ +# Using the node alpine image to build the React app +image: node:alpine + +# Announce the URL as per CRA docs +# https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration + +# Cache node modules - speeds up future builds +#cache: +# paths: +# - node_modules + +# Name the stages involved in the pipeline +stages: +- deploy + +# Job name for gitlab to recognise this results in assets for Gitlab Pages +# https://docs.gitlab.com/ee/user/project/pages/introduction.html#gitlab-pages-requirements +pages: + stage: deploy + script: + - npm install # Install all dependencies + - npm run build --prod # Build for prod + - cp public/index.html public/404.html # Not necessary, but helps with https://medium.com/@pshrmn/demystifying-single-page-applications-3068d0555d46 + - mv public _public # CRA and gitlab pages both use the public folder. Only do this in a build pipeline. + - mv build public # Move build files to public dir for Gitlab Pages + artifacts: + paths: + - public # The built files for Gitlab Pages to serve + only: + - master # Only run on master branch \ No newline at end of file