@@ -48,23 +48,21 @@ check:lint:
4848 npm run lint;
4949 '
5050 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]+)?$/
5254 when : manual
53- - if : $CI_COMMIT_BRANCH == 'master'
54- when : manual
55- - when : always
5655
5756check:nix-dry :
5857 stage : check
5958 needs : []
6059 script :
6160 - nix-build -v -v --dry-run ./release.nix
6261 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]+)?$/
6665 when : manual
67- - when : always
6866
6967check:test :
7068 stage : check
@@ -81,19 +79,15 @@ check:test:
8179 junit :
8280 - ./tmp/junit.xml
8381 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]+)?$/
8784 when : manual
88- # This job will be overridden by `build:linux`
89- - if : $CI_COMMIT_BRANCH == 'staging'
90- when : never
91- - when : always
9285
9386build:linux :
9487 stage : build
9588 needs :
96- - check:lint
89+ - job : check:lint
90+ optional : true
9791 script :
9892 - >
9993 nix-shell --run '
@@ -107,17 +101,17 @@ build:linux:
107101 - ./tmp/junit.xml
108102 paths :
109103 - ./prebuilds/
104+ # Only the build:linux preserves the dist
105+ - ./dist
110106 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]+)?$/
116109
117110build:windows :
118111 stage : build
119112 needs :
120- - check:lint
113+ - job : check:lint
114+ optional : true
121115 tags :
122116 - windows
123117 before_script :
@@ -138,16 +132,14 @@ build:windows:
138132 paths :
139133 - ./prebuilds/
140134 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]+)?$/
146137
147138build:macos :
148139 stage : build
149140 needs :
150- - check:lint
141+ - job : check:lint
142+ optional : true
151143 tags :
152144 - shared-macos-amd64
153145 image : macos-11-xcode-12
@@ -174,11 +166,30 @@ build:macos:
174166 paths :
175167 - ./prebuilds/
176168 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]+$/
182193
183194integration:builds :
184195 stage : integration
@@ -213,11 +224,8 @@ integration:builds:
213224 paths :
214225 - ./builds/
215226 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]+)?$/
221229
222230integration:nix :
223231 stage : integration
@@ -232,11 +240,8 @@ integration:nix:
232240 )"
233241 - $build_application/bin/typescript-demo-lib
234242 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]+)?$/
240245
241246integration:docker :
242247 stage : integration
@@ -253,11 +258,8 @@ integration:docker:
253258 - image="$(docker load --input ./builds/*docker* | cut -d' ' -f3)"
254259 - docker run "$image"
255260 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]+)?$/
261263
262264integration:linux :
263265 stage : integration
@@ -267,11 +269,8 @@ integration:linux:
267269 script :
268270 - for f in ./builds/*-linux-*; do "$f"; done
269271 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]+)?$/
275274
276275integration:windows :
277276 stage : integration
@@ -282,11 +281,8 @@ integration:windows:
282281 script :
283282 - Get-ChildItem -File ./builds/*-win-* | ForEach {& $_.FullName}
284283 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]+)?$/
290286
291287integration:macos :
292288 stage : integration
@@ -298,11 +294,8 @@ integration:macos:
298294 script :
299295 - for f in ./builds/*-macos-x64*; do "$f"; done
300296 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]+)?$/
306299
307300# packages:
308301# stage: release
0 commit comments