-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
45 lines (40 loc) · 1.46 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Using the node alpine image to build the React app
image: trion/ng-cli-karma
# Announce the URL as per CRA docs
# https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#advanced-configuration
variables:
PUBLIC_URL: /angular-master-detail
cache:
paths:
- node_modules
before_script:
- npm ci
# Name the stages involved in the pipeline
stages:
- build
- deploy
build:
stage: build
script:
- ./node_modules/@angular/cli/bin/ng test app-example --progress false --watch=false
- ./node_modules/@angular/cli/bin/ng test lib-master-detail --progress false --watch=false
- ./node_modules/@angular/cli/bin/ng build app-example --prod
artifacts:
untracked: true
only:
- merge_requests
- master
# 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
deploy:
stage: deploy
script:
- npm install # Install all dependencies
- ./node_modules/@angular/cli/bin/ng build app-example --prod # Build for prod
- cp ./dist/app-example/index.html ./dist/app-example/404.html # Not necessary, but helps with https://medium.com/@pshrmn/demystifying-single-page-applications-3068d0555d46
- mv ./dist/app-example 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