-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
199 lines (174 loc) · 4.63 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
199 lines (174 loc) · 4.63 KB
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
image: node:18.20.7-alpine
include:
- project: "procivis/one/one-operations"
file:
- "gitlab/docker.gitlab-ci.yml"
- "gitlab/github.gitlab-ci.yml"
- "gitlab/ci-tools.gitlab-ci.yml"
variables:
PNPM_CACHE_FOLDER: "~/.pnpm-store"
workflow:
rules:
- if: $CI_COMMIT_BRANCH
- if: $CI_COMMIT_TAG
stages:
- prepare
- test
- build
- publish
- deploy
- github
- sync_with_jira
.build-cache: &build-cache
key:
files:
- pnpm-lock.yaml
- package.json
paths:
- node_modules/
- lib/
- ${PNPM_CACHE_FOLDER}
policy: pull
.app_settings: &app_settings
- APP_VERSION=${APP_VERSION:-$CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA}
- IMAGE_NAME=$CI_REGISTRY_IMAGE/storybook
- IMAGE_TAG=$APP_VERSION
.config_private_registry: &config_private_registry
- npm config set -- @procivis:registry https://${CI_SERVER_HOST}/api/v4/packages/npm/
- npm config set -- //${CI_SERVER_HOST}/:_authToken ${CI_JOB_TOKEN}
- npm config set -- //${CI_SERVER_HOST}/api/v4/packages/npm/:_authToken ${CI_JOB_TOKEN}
.pnpm_install: &pnpm_install
- npm install --global corepack@latest
- corepack enable
- corepack prepare pnpm@latest-10 --activate
- export PNPM_HOME=$HOME/.local/share/pnpm
- export PATH="$PNPM_HOME:$PATH"
- pnpm config set global-bin-dir $PNPM_HOME
- pnpm config set store-dir ${PNPM_CACHE_FOLDER}
.install-node-modules: &install-node-modules
- >
if [ -d ./node_modules ] && [ "$(ls -A ./node_modules)" ]; then
echo "node_modules exists and seems valid, not re-installing deps."
else
echo "node_modules does not exist or is not valid, re-installing deps."
apk add --update --no-cache --virtual .build-deps alpine-sdk libc6-compat gcompat bash
npm config set -- @procivis:registry https://${CI_SERVER_HOST}/api/v4/packages/npm/
npm config set -- //${CI_SERVER_HOST}/:_authToken ${CI_JOB_TOKEN}
npm config set -- //${CI_SERVER_HOST}/api/v4/packages/npm/:_authToken ${CI_JOB_TOKEN}
pnpm add -g node-gyp @mapbox/node-pre-gyp
pnpm install --frozen-lockfile --network-concurrency 1
fi
.modules_setup:
cache:
<<: *build-cache
before_script:
- *config_private_registry
- *pnpm_install
- *install-node-modules
- *app_settings
.only_tag:
rules:
- if: $CI_COMMIT_TAG
.only_manual_tag:
rules:
- if: $CI_COMMIT_TAG
when: manual
.only_main:
rules:
- if: $CI_COMMIT_REF_NAME == "main"
before_script:
- *app_settings
build_deps:
stage: prepare
extends: .modules_setup
script:
- pnpm prepare
cache:
policy: pull-push
lint:
stage: test
needs: [build_deps]
extends: .modules_setup
script:
- pnpm lint
compile:
stage: test
needs: [build_deps]
extends: .modules_setup
script:
- pnpm typescript
test:
stage: test
needs: [build_deps]
extends: .modules_setup
script:
- pnpm test
build:storybook:
stage: build
needs: [build_deps]
extends:
- .modules_setup
- .only_main
script:
- pnpm build-storybook
artifacts:
paths:
- storybook-static
publish:storybook:
stage: publish
needs:
- job: build:storybook
artifacts: true
extends:
- .release_docker_image
- .only_main
publish:npm:private:
stage: deploy
script:
- npm config set @procivis:registry https://${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/
- npm config set //${CI_SERVER_HOST}/api/v4/projects/${CI_PROJECT_ID}/packages/npm/:_authToken ${CI_JOB_TOKEN}
- npm publish --verbose --access restricted --tag stable
extends:
- .modules_setup
- .only_tag
publish:npm:public:
stage: deploy
before_script:
- *pnpm_install
- *install-node-modules
script:
- npm config set //registry.npmjs.org/:_authToken ${NPMJS_TOKEN}
- npm publish --verbose --access public
extends:
- .modules_setup
- .only_manual_tag
deploy:storybook:
stage: deploy
needs:
- publish:storybook
extends:
- .only_main
variables:
HELM_VALUES_FILE: values/app-components.dev.procivis-one.yaml
K8S_NAMESPACE: default
HELM_APP_NAME: react-native
HELM_PATH: charts/one-rn-components-chart
DEPLOY_IMAGE_TAG: $CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA
PROJECT_TITLE: $CI_PROJECT_TITLE
DEPLOY_ENVIRONMENT: Dev
DEPLOYMENT_NAME: react-native-app-components-chart
trigger:
project: procivis/one/one-operations
branch: main
strategy: depend
github:push:
stage: github
variables:
GITHUB_PROJECT: "procivis/one-react-native-components"
PROJECT: $CI_PROJECT_NAME
extends:
- .ci-tool:open_source_release
set_jira_version:
stage: sync_with_jira
extends:
- .ci-tool:set_jira_version