How to deploy micro services from a mono repo

ok, so I have a mono repo or project. Each dir is a micro service.

root
admin
website
creditcard

Now I want to create a pipeline that when I file changes in one of the directories, it will build and deploy that micro service.

My thinking is to create one .gitlab-ci.yml in the root dir. This then when a file changes in a path it would either include another file just for that micro service or use the trigger keywork to run a child pipeline. Now when I follow the examples I keep getting the error “changes” is an invalid rule.

I can’t seem to get the examples in the docs to work. Here is what I am trying

one job to rule them all:
  rules:
    - if: $CI_MERGE_REQUEST_ID

# changes in the admin server file structure..
include:
  - local: "admin_server/.gitlab-ci.yml"
    rules:
      - changes:
          - admin_server/*

Can you shed some light on how to go about this.

Thanks
Brad

Here is the solution I came up with

admin server build:
  trigger:
    include: "admin_server/.gitlab-ci.yml"
  rules:
    - if: '$CI_COMMIT_BRANCH == "main"'
      changes:
        - admin_server/*