99 interruptible : true
1010
1111variables :
12+ GH_PROJECT_PATH : " MatrixAI/${CI_PROJECT_NAME}"
13+ GH_PROJECT_URL : " https://${GITHUB_TOKEN}@github.com/${GH_PROJECT_PATH}.git"
1214 GIT_SUBMODULE_STRATEGY : recursive
1315 # Cache .npm
1416 NPM_CONFIG_CACHE : " ${CI_PROJECT_DIR}/tmp/npm"
@@ -94,12 +96,10 @@ check:test:
9496build:merge :
9597 stage : build
9698 needs : []
97- # Don't interrupt pr creation job
98- interruptible : false
9999 allow_failure : true
100100 script :
101101 # Required for `gh pr create`
102- - git remote add upstream "https://${GITHUB_TOKEN}@github.com/MatrixAI/TypeScript-Demo-Lib-Native.git "
102+ - git remote add upstream "$GH_PROJECT_URL "
103103 - >
104104 nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
105105 gh pr create \
@@ -109,10 +109,11 @@ build:merge:
109109 --body "This is an automatic PR generated by the pipeline CI/CD. This will be automatically fast-forward merged if successful." \
110110 --assignee "@me" \
111111 --no-maintainer-edit \
112- --repo MatrixAI/TypeScript-Demo-Lib-Native || true;
113- gh pr comment staging \
114- --body "Pipeline Attempt ${CI_PIPELINE_ID} - ${CI_PIPELINE_URL}" \
115- --repo MatrixAI/TypeScript-Demo-Lib-Native;
112+ --repo "$GH_PROJECT_PATH" || true;
113+ printf "Pipeline Attempt on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
114+ | gh pr comment staging \
115+ --body-file - \
116+ --repo "$GH_PROJECT_PATH";
116117 '
117118 rules :
118119 # Runs on staging commits and ignores version commits
@@ -136,7 +137,6 @@ build:linux:
136137 reports :
137138 junit :
138139 - ./tmp/junit.xml
139- paths :
140140 # Only the build:linux preserves the dist
141141 - ./dist
142142 rules :
@@ -214,7 +214,6 @@ build:prerelease:
214214 - build:macos
215215 # Don't interrupt publishing job
216216 interruptible : false
217- allow_failure : true
218217 before_script :
219218 - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
220219 script :
@@ -276,6 +275,8 @@ integration:deployment:
276275 - integration:builds
277276 # Don't interrupt deploying job
278277 interruptible : false
278+ # Requires mutual exclusion
279+ resource_group : integration:deployment
279280 script :
280281 - echo 'Perform service deployment for integration testing'
281282 rules :
@@ -390,12 +391,11 @@ integration:prerelease:
390391 optional : true
391392 # Don't interrupt publishing job
392393 interruptible : false
393- allow_failure : true
394394 script :
395395 - echo 'Publishing application prerelease'
396396 - >
397397 nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
398- if gh release view "$CI_COMMIT_TAG" --repo MatrixAI/TypeScript-Demo-Lib-Native >/dev/null; then \
398+ if gh release view "$CI_COMMIT_TAG" --repo "$GH_PROJECT_PATH" >/dev/null; then \
399399 gh release \
400400 upload "$CI_COMMIT_TAG" \
401401 builds/*.closure.gz \
@@ -404,7 +404,7 @@ integration:prerelease:
404404 builds/*-win-* \
405405 builds/*-macos-* \
406406 --clobber \
407- --repo MatrixAI/TypeScript-Demo-Lib-Native ; \
407+ --repo "$GH_PROJECT_PATH" ; \
408408 else \
409409 gh release \
410410 create "$CI_COMMIT_TAG" \
@@ -417,11 +417,11 @@ integration:prerelease:
417417 --notes "" \
418418 --prerelease \
419419 --target staging \
420- --repo MatrixAI/TypeScript-Demo-Lib-Native ; \
420+ --repo "$GH_PROJECT_PATH" ; \
421421 fi;
422422 '
423423 rules :
424- # Only runs on tag pipeline where the tag is a release version
424+ # Only runs on tag pipeline where the tag is a prerelease version
425425 # This requires dependencies to also run on tag pipeline
426426 # However version tag comes with a version commit
427427 # Dependencies must not run on the version commit
@@ -447,8 +447,8 @@ integration:merge:
447447 - job : integration:macos
448448 artifacts : false
449449 optional : true
450- # Don't interrupt pr merging job
451- interruptible : false
450+ # Requires mutual exclusion
451+ resource_group : integration:merge
452452 allow_failure : true
453453 variables :
454454 # Ensure that CI/CD is fetching all commits
@@ -458,13 +458,15 @@ integration:merge:
458458 script :
459459 - >
460460 nix-shell -I nixpkgs=./pkgs.nix --packages gitAndTools.gh --run '
461- gh pr comment staging \
462- --body "Pipeline Succeeded ${CI_PIPELINE_ID} - ${CI_PIPELINE_URL}" \
463- --repo MatrixAI/TypeScript-Demo-Lib-Native;
461+ printf "Pipeline Succeeded on ${CI_PIPELINE_ID} for ${CI_COMMIT_SHA}\n\n${CI_PIPELINE_URL}" \
462+ | gh pr comment staging \
463+ --body-file - \
464+ --repo "$GH_PROJECT_PATH";
464465 '
465- - git remote add upstream "https://${GITHUB_TOKEN}@github.com/MatrixAI/TypeScript-Demo-Lib-Native.git "
466+ - git remote add upstream "$GH_PROJECT_URL "
466467 - git checkout origin/master
467- - git merge --ff-only origin/staging
468+ # Merge up to the current commit (not the latest commit)
469+ - git merge --ff-only "$CI_COMMIT_SHA"
468470 - git push upstream HEAD:master
469471 rules :
470472 # Runs on staging commits and ignores version commits
@@ -483,6 +485,8 @@ release:deployment:
483485 artifacts : true
484486 # Don't interrupt deploying job
485487 interruptible : false
488+ # Requires mutual exclusion
489+ resource_group : release:deployment
486490 script :
487491 - echo 'Perform service deployment for production'
488492 rules :
@@ -516,7 +520,6 @@ release:distribution:
516520 artifacts : true
517521 # Don't interrupt publishing job
518522 interruptible : false
519- allow_failure : true
520523 before_script :
521524 - echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ./.npmrc
522525 script :
@@ -537,7 +540,7 @@ release:distribution:
537540 --title "Build-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
538541 --notes "" \
539542 --target master \
540- --repo MatrixAI/TypeScript-Demo-Lib-Native ;
543+ --repo "$GH_PROJECT_PATH" ;
541544 '
542545 after_script :
543546 - rm -f ./.npmrc
0 commit comments