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
and publish `MyPackage` anytime changes are made to anywhere _except_ the `Foo`
directory on the `master` branch.
```shell
```yaml
image: node:latest
stages:
- build
.default-rule: &default-rule
if: '$CI_MERGE_REQUEST_IID || $CI_COMMIT_REF_SLUG == "master"'
.foo-package:
build-foo-package:
stage: build
variables:
PACKAGE: "Foo"
before_script:
script:
- cd src/components/Foo
- echo "Building $PACKAGE"
- npm publish
only:
refs:
- master
- merge_requests
changes:
- "src/components/Foo/**/*"
.parent-package:
build-my-project-package:
stage: build
variables:
PACKAGE: "MyPackage"
except:
changes:
- "src/components/Foo/**/*"
.build-package:
stage: build
script:
- echo "Building $PACKAGE"
- npm publish
rules:
- <<: *default-rule
build-foo-package:
extends:
- .build-package
- .foo-package
build-my-project-package:
extends:
- .build-package
- .parent-package
only:
refs:
- master
- merge_requests
except:
changes:
- "src/components/Foo/**/*"
```
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