-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
59 lines (54 loc) · 1.07 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
# a template for gitlab ci/cd, if you dont use gitlab
# then you can safely delete this file.
stages:
- test
- build
- deploy
variables:
TAG: $CI_REGISTRY/$CI_PROJECT_PATH:$CI_COMMIT_REF_NAME
test:
stage: test
image:
name: node:12.16-alpine
cache:
paths:
- node_modules/
key:
files:
- package.json
only:
- merge_requests
script:
- yarn --production=false --network-concurrency 1
- yarn test
build:
stage: build
image:
name: node:12.16-alpine
cache:
paths:
- node_modules/
key:
files:
- package.json
only:
- tags
before_script:
- apk add build-base python-dev py-pip jpeg-dev zlib-dev git python make g++ # for image optimization dependency and ssh
script:
- yarn --production=false --network-concurrency 1
- yarn build
- yarn # this will remove dev deps
artifacts:
paths:
- .next
- node_modules
expire_in: 1 week
deploy:
stage: deploy
only:
- tags
dependencies:
- build
script:
- docker build -t $TAG -f docker/Dockerfile .