Skip to content

Commit 0a0901d

Browse files
committed
Added build:prerelease and release:distribution jobs and integration:merge now depends on build jobs
1 parent 4ef9f84 commit 0a0901d

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

.gitlab-ci.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,61 @@ build:macos:
199199
# Runs on tag pipeline where the tag is a prerelease or release version
200200
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
201201

202+
build:prerelease:
203+
stage: build
204+
needs:
205+
- build:linux
206+
- build:windows
207+
- build:macos
208+
# Don't interrupt publishing job
209+
interruptible: false
210+
before_script:
211+
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
212+
script:
213+
- echo 'Publishing library prerelease'
214+
- >
215+
nix-shell --run '
216+
npm publish --tag prerelease --access public;
217+
'
218+
- >
219+
for d in prebuilds/*; do
220+
tar \
221+
--create \
222+
--verbose \
223+
--file="prebuilds/$(basename $d).tar" \
224+
--directory=prebuilds \
225+
"$(basename $d)";
226+
done
227+
- >
228+
nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
229+
gh release \
230+
create "$CI_COMMIT_TAG" \
231+
prebuilds/*.tar \
232+
--title "${CI_COMMIT_TAG}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
233+
--notes "" \
234+
--prerelease \
235+
--target staging \
236+
--repo "$GH_PROJECT_PATH";
237+
'
238+
after_script:
239+
- rm -f ./.npmrc
240+
rules:
241+
# Only runs on tag pipeline where the tag is a prerelease version
242+
# This requires dependencies to also run on tag pipeline
243+
# However version tag comes with a version commit
244+
# Dependencies must not run on the version commit
245+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+-.*[0-9]+$/
246+
202247
integration:merge:
203248
stage: integration
204249
needs:
205250
- build:merge
251+
- job: build:linux
252+
optional: true
253+
- job: build:windows
254+
optional: true
255+
- job: build:macos
256+
optional: true
206257
# Requires mutual exclusion
207258
resource_group: integration:merge
208259
allow_failure: true
@@ -229,3 +280,48 @@ integration:merge:
229280
- if: $CI_COMMIT_BRANCH == 'staging' && $CI_COMMIT_TITLE !~ /^[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
230281
# Runs on tag pipeline where the tag is a prerelease or release version
231282
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+(?:-.*[0-9]+)?$/
283+
284+
release:distribution:
285+
stage: release
286+
needs:
287+
- build:linux
288+
- build:windows
289+
- build:macos
290+
- integration:merge
291+
# Don't interrupt publishing job
292+
interruptible: false
293+
before_script:
294+
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
295+
script:
296+
- echo 'Publishing library'
297+
- >
298+
nix-shell --run '
299+
npm publish --access public;
300+
'
301+
- >
302+
for d in prebuilds/*; do
303+
tar \
304+
--create \
305+
--verbose \
306+
--file="prebuilds/$(basename $d).tar" \
307+
--directory=prebuilds \
308+
"$(basename $d)";
309+
done
310+
- >
311+
nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
312+
gh release \
313+
create "$CI_COMMIT_TAG" \
314+
prebuilds/*.tar \
315+
--title "${CI_COMMIT_TAG}-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
316+
--notes "" \
317+
--target master \
318+
--repo "$GH_PROJECT_PATH";
319+
'
320+
after_script:
321+
- rm -f ./.npmrc
322+
rules:
323+
# Only runs on tag pipeline where the tag is a release version
324+
# This requires dependencies to also run on tag pipeline
325+
# However version tag comes with a version commit
326+
# Dependencies must not run on the version commit
327+
- if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/

0 commit comments

Comments
 (0)