-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
73 lines (64 loc) · 1.68 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
image: node:8-alpine
# Using alpine instead of the HMLR image to temporarily work around zlib problems with centos: https://github.com/nodejs/node/issues/22839
######## PIPELINE ########
# Here we define the full pipeline - a list of stages that get executed in order.
stages:
- install
- check
- publish
######## JOBS ########
# Now we define the jobs that go into the various stages of the pipeline.
node_modules:
stage: install
script:
- npm -v
- node -v
- npm ci
- npm run installGovukFrontend
after_script:
- npm ls
tags:
- docker/node:8-alpine
artifacts:
# Have to use artifacts instead of cache, since cache is only based on a "best effort"
# to cache items, and cannot be relied upon.
paths:
- node_modules
expire_in: 1 hour
js-tests:
stage: check
script:
- npm test
tags:
- docker/node:8-alpine
js-lint:
stage: check
script:
- npm run lint
tags:
- docker/node:8-alpine
check-tag:
stage: check
only:
- tags
script:
- >
grep "\"version\": \"${CI_COMMIT_REF_NAME}\"" package.json && echo "Tag matches package.json" || (echo "Specified tag in Git does not match that defined in package.json. Aborting..." && exit 1)
tags:
- docker/node:8-alpine
publish_node:
stage: publish
only:
- tags
script:
# Put together a distributable package containing a subset of the files
- mkdir node_dist
- cp -r src/components/govukComponents/* node_dist
- cp package* node_dist
- npm config set _auth $NPM_TOKEN
- npm config set registry $NPM_REGISTRY
- npm config set email=$NPM_EMAIL
# Publish the package
- npm publish node_dist
tags:
- docker/node:8-alpine