-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitlab-ci.yml
88 lines (79 loc) · 1.9 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
78
79
80
81
82
83
84
85
86
87
88
default:
image: node:16.14.0
variables:
KUBERNETES_CPU_REQUEST: 4
KUBERNETES_CPU_LIMIT: 4
KUBERNETES_MEMORY_REQUEST: 8Gi
KUBERNETES_MEMORY_LIMIT: 8Gi
cache:
key:
files:
- yarn.lock
- package.json
paths:
- .yarn
- node_modules
.build-and-test-rules:
rules:
# Rules to avoid duplicated pipelines.
- if: $CI_PIPELINE_SOURCE != "external_pull_request_event"
stages:
- build-and-test
- create-release
- sync
build:
extends:
- .build-and-test-rules
stage: build-and-test
script:
- pwd
- yarn install --frozen-lockfile
- yarn build
artifacts:
paths:
- dist
- node_modules
test:
extends:
- .build-and-test-rules
stage: build-and-test
coverage: /All\sfiles.*?\s+(\d+.\d+)/
script:
- pwd
- yarn install --frozen-lockfile
- yarn lint
- yarn test
artifacts:
paths:
- coverage
release:
stage: create-release
rules:
- if: $CI_COMMIT_BRANCH == 'master'
when: manual
before_script:
- apt-get update && apt-get install -y --no-install-recommends git-core ca-certificates
script:
- echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" >> .npmrc
- yarn install --frozen-lockfile
- yarn release
release-to-github:
stage: sync
rules:
- if: $CI_COMMIT_TAG
script:
- echo "" >> .npmrc # ensure new line
- echo "@airwallex:registry=https://npm.pkg.github.com/" >> .npmrc
- echo "//npm.pkg.github.com/:_authToken=\${GITHUB_TOKEN}" >> .npmrc
- yarn install --frozen-lockfile
- yarn publish
release-to-gitlab:
stage: sync
rules:
- if: $CI_COMMIT_TAG
script:
- echo "" >> .npmrc # ensure new line
- echo "@airwallex:registry=https://gitlab.awx.im/api/v4/projects/3003/packages/npm/" >> .npmrc
- echo "//gitlab.awx.im/api/v4/projects/3003/packages/npm/:_authToken=\${GITLAB_TOKEN}" >> .npmrc
- yarn install --frozen-lockfile
- yarn publish