Commit 799a2159 authored by Suzanne Selhorn's avatar Suzanne Selhorn Committed by Marcel Amirault

Docs: Updated monorepo example

Related to: https://gitlab.com/gitlab-org/gitlab/-/issues/227381
parent 3d51a0b3
...@@ -82,44 +82,39 @@ Using the example project above, this `gitlab-ci.yml` file will publish ...@@ -82,44 +82,39 @@ Using the example project above, this `gitlab-ci.yml` file will publish
and publish `MyPackage` anytime changes are made to anywhere _except_ the `Foo` and publish `MyPackage` anytime changes are made to anywhere _except_ the `Foo`
directory on the `master` branch. directory on the `master` branch.
```shell ```yaml
image: node:latest
stages: stages:
- build - build
.default-rule: &default-rule build-foo-package:
if: '$CI_MERGE_REQUEST_IID || $CI_COMMIT_REF_SLUG == "master"' stage: build
.foo-package:
variables: variables:
PACKAGE: "Foo" PACKAGE: "Foo"
before_script: script:
- cd src/components/Foo - cd src/components/Foo
- echo "Building $PACKAGE"
- npm publish
only: only:
refs:
- master
- merge_requests
changes: changes:
- "src/components/Foo/**/*" - "src/components/Foo/**/*"
.parent-package: build-my-project-package:
stage: build
variables: variables:
PACKAGE: "MyPackage" PACKAGE: "MyPackage"
except:
changes:
- "src/components/Foo/**/*"
.build-package:
stage: build
script: script:
- echo "Building $PACKAGE" - echo "Building $PACKAGE"
- npm publish - npm publish
rules: only:
- <<: *default-rule refs:
- master
build-foo-package: - merge_requests
extends: except:
- .build-package changes:
- .foo-package - "src/components/Foo/**/*"
build-my-project-package:
extends:
- .build-package
- .parent-package
``` ```
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment