@@ -48,23 +48,21 @@ check:lint:
48
48
npm run lint;
49
49
'
50
50
rules :
51
- - if : $CI_COMMIT_TAG
51
+ - if : $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
52
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
53
+ - if : $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
52
54
when : manual
53
- - if : $CI_COMMIT_BRANCH == 'master'
54
- when : manual
55
- - when : always
56
55
57
56
check:nix-dry :
58
57
stage : check
59
58
needs : []
60
59
script :
61
60
- nix-build -v -v --dry-run ./release.nix
62
61
rules :
63
- - if : $CI_COMMIT_TAG
64
- when : manual
65
- - if : $CI_COMMIT_BRANCH == 'master'
62
+ - if : $CI_COMMIT_BRANCH =~ /^(?:feature.*|staging)$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
63
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
64
+ - if : $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
66
65
when : manual
67
- - when : always
68
66
69
67
check:test :
70
68
stage : check
@@ -81,19 +79,15 @@ check:test:
81
79
junit :
82
80
- ./tmp/junit.xml
83
81
rules :
84
- - if : $CI_COMMIT_TAG
85
- when : manual
86
- - if : $CI_COMMIT_BRANCH == 'master'
82
+ - if : $CI_COMMIT_BRANCH =~ /^feature.*$/ && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
83
+ - if : $CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != 'master' && $CI_COMMIT_BRANCH != 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
87
84
when : manual
88
- # This job will be overridden by `build:linux`
89
- - if : $CI_COMMIT_BRANCH == 'staging'
90
- when : never
91
- - when : always
92
85
93
86
build:linux :
94
87
stage : build
95
88
needs :
96
- - check:lint
89
+ - job : check:lint
90
+ optional : true
97
91
script :
98
92
- >
99
93
nix-shell --run '
@@ -107,17 +101,17 @@ build:linux:
107
101
- ./tmp/junit.xml
108
102
paths :
109
103
- ./prebuilds/
104
+ # Only the build:linux preserves the dist
105
+ - ./dist
110
106
rules :
111
- - if : $CI_COMMIT_TAG
112
- when : manual
113
- - if : $CI_COMMIT_BRANCH == 'master'
114
- when : manual
115
- - if : $CI_COMMIT_BRANCH == 'staging'
107
+ - if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
108
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
116
109
117
110
build:windows :
118
111
stage : build
119
112
needs :
120
- - check:lint
113
+ - job : check:lint
114
+ optional : true
121
115
tags :
122
116
- windows
123
117
before_script :
@@ -138,16 +132,14 @@ build:windows:
138
132
paths :
139
133
- ./prebuilds/
140
134
rules :
141
- - if : $CI_COMMIT_TAG
142
- when : manual
143
- - if : $CI_COMMIT_BRANCH == 'master'
144
- when : manual
145
- - if : $CI_COMMIT_BRANCH == 'staging'
135
+ - if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
136
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
146
137
147
138
build:macos :
148
139
stage : build
149
140
needs :
150
- - check:lint
141
+ - job : check:lint
142
+ optional : true
151
143
tags :
152
144
- shared-macos-amd64
153
145
image : macos-11-xcode-12
@@ -174,11 +166,30 @@ build:macos:
174
166
paths :
175
167
- ./prebuilds/
176
168
rules :
177
- - if : $CI_COMMIT_TAG
178
- when : manual
179
- - if : $CI_COMMIT_BRANCH == 'master'
180
- when : manual
181
- - if : $CI_COMMIT_BRANCH == 'staging'
169
+ - if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
170
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
171
+
172
+ build:prerelease :
173
+ stage : build
174
+ needs :
175
+ - build:linux
176
+ - build:windows
177
+ - build:macos
178
+ # Don't interrupt publishing job
179
+ interruptible : false
180
+ allow_failure : true
181
+ before_script :
182
+ - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
183
+ script :
184
+ - >
185
+ nix-shell --run '
186
+ npm publish --tag prerelease --access public;
187
+ '
188
+ after_script :
189
+ - rm -f ./.npmrc
190
+ rules :
191
+ # Only prerelease tag
192
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+-.*[0-9]+$/
182
193
183
194
integration:builds :
184
195
stage : integration
@@ -213,11 +224,8 @@ integration:builds:
213
224
paths :
214
225
- ./builds/
215
226
rules :
216
- - if : $CI_COMMIT_TAG
217
- when : manual
218
- - if : $CI_COMMIT_BRANCH == 'master'
219
- when : manual
220
- - if : $CI_COMMIT_BRANCH == 'staging'
227
+ - if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
228
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
221
229
222
230
integration:nix :
223
231
stage : integration
@@ -232,11 +240,8 @@ integration:nix:
232
240
)"
233
241
- $build_application/bin/typescript-demo-lib
234
242
rules :
235
- - if : $CI_COMMIT_TAG
236
- when : manual
237
- - if : $CI_COMMIT_BRANCH == 'master'
238
- when : manual
239
- - if : $CI_COMMIT_BRANCH == 'staging'
243
+ - if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
244
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
240
245
241
246
integration:docker :
242
247
stage : integration
@@ -253,11 +258,8 @@ integration:docker:
253
258
- image="$(docker load --input ./builds/*docker* | cut -d' ' -f3)"
254
259
- docker run "$image"
255
260
rules :
256
- - if : $CI_COMMIT_TAG
257
- when : manual
258
- - if : $CI_COMMIT_BRANCH == 'master'
259
- when : manual
260
- - if : $CI_COMMIT_BRANCH == 'staging'
261
+ - if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
262
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
261
263
262
264
integration:linux :
263
265
stage : integration
@@ -267,11 +269,8 @@ integration:linux:
267
269
script :
268
270
- for f in ./builds/*-linux-*; do "$f"; done
269
271
rules :
270
- - if : $CI_COMMIT_TAG
271
- when : manual
272
- - if : $CI_COMMIT_BRANCH == 'master'
273
- when : manual
274
- - if : $CI_COMMIT_BRANCH == 'staging'
272
+ - if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
273
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
275
274
276
275
integration:windows :
277
276
stage : integration
@@ -282,11 +281,8 @@ integration:windows:
282
281
script :
283
282
- Get-ChildItem -File ./builds/*-win-* | ForEach {& $_.FullName}
284
283
rules :
285
- - if : $CI_COMMIT_TAG
286
- when : manual
287
- - if : $CI_COMMIT_BRANCH == 'master'
288
- when : manual
289
- - if : $CI_COMMIT_BRANCH == 'staging'
284
+ - if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
285
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
290
286
291
287
integration:macos :
292
288
stage : integration
@@ -298,11 +294,8 @@ integration:macos:
298
294
script :
299
295
- for f in ./builds/*-macos-x64*; do "$f"; done
300
296
rules :
301
- - if : $CI_COMMIT_TAG
302
- when : manual
303
- - if : $CI_COMMIT_BRANCH == 'master'
304
- when : manual
305
- - if : $CI_COMMIT_BRANCH == 'staging'
297
+ - if : $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
298
+ - if : $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
306
299
307
300
# packages:
308
301
# stage: release
0 commit comments