diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a59ab80..6674205 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -51,10 +51,15 @@ publish:development: # Version and publish - npx lerna publish --yes --canary --preid ${NPM_TAG} --dist-tag ${NPM_TAG} - rules: - # Only run on development branch and when actioning merge requests. - # NOTE: If we don't run on only merge requests, we end up with an infinite looping due to Lerna updating the branch with its version commits. - - if: $CI_COMMIT_BRANCH == "development" && $CI_PIPELINE_SOURCE == 'merge_request_event' + only: + - development + +# TODO: Document the Lerna Recursive problem when we run lerna version on our main branch. +# NOTE: The "lerna version" command will create a new commit and push it to our main branch. +# This can create a problem where our CI on the "main" branch is recursively triggered. +# To prevent this, we add [ci skip] to our Lerna Version commit message. +# This is supported OOTB by GitLab (and GitHub). +# See: https://docs.gitlab.com/ee/ci/pipelines/#skip-a-pipeline # Publish the documentation to GitLab Pages (for now). pages: diff --git a/lerna.json b/lerna.json index c26710c..f499e34 100644 --- a/lerna.json +++ b/lerna.json @@ -4,14 +4,13 @@ "packages": [ "packages/*" ], - "npmClient": "npm", "command": { "version": { "allowBranch": [ "development" ], "exact": true, - "message": "chore: increment patch version to %v" + "message": "chore: Version %v [skip ci]" }, "publish": { "registry": "https://registry.npmjs.org/",