-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy path.gitlab-ci.yml
77 lines (71 loc) · 1.4 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
74
75
76
77
image: node:10
cache:
key: $CI_BUILD_REF_SLUG
paths:
- node_modules/
stages:
- setup
- test
- build
- release
- deploy
#########
# SETUP #
#########
setup:
stage: setup
script:
- yarn install --frozen-lockfile
artifacts:
paths:
- node_modules/
########
# TEST #
########
lint:
stage: test
cache:
policy: pull
script:
- yarn lint
test:
stage: test
cache:
policy: pull
script:
- cp .env.example .env
- yarn test
#########
# BUILD #
#########
build_image:
stage: build
image: docker:latest
variables:
DOCKER_DRIVER: overlay2
services:
- docker:dind
script:
- docker login --username gitlab-ci-token --password $CI_BUILD_TOKEN $CI_REGISTRY
# if the branch is master, use the latest tag. When the repository is tagged (git tag), the docker image tag should reflect that.
- '[ "$CI_COMMIT_REF_SLUG" == "master" ] && CI_COMMIT_REF_SLUG=latest'
- docker build --network host --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
only:
- master
except:
- tags
# skip artifacts and cache download for this job
dependencies: []
cache: {}
###############
# NPM RELEASE #
###############
release:
stage: release
cache:
policy: pull
only:
- master
script:
- /bin/sh $(pwd)/scripts/ci-release.sh