Deploy individual services from a monorepo using github actions

You could also run some script to discover which services were changed based on git diff and trigger corresponding job via GitHub REST API.

There could be two workflows main.yml and services.yml.

Main workflow will be configured to be started always on push and it will only start script to find out which services were changed. For each changed service repository dispatch event will be triggered with service name in payload.

Services workflow will be configured to be started on repository_dispatch and it will contain one job for each service. Jobs would have additional condition based on event payload.

See showcase with similar setup: https://github.com/zladovan/monorepo


GitHub Actions supports monorepos with path filtering for workflows. You can create a workflow to selectively trigger when files on a specific path change.

https://help.github.com/en/articles/workflow-syntax-for-github-actions#onpushpull_requestpaths

For example, this workflow will trigger on a push when any files under the path service_A/ have changed (note the ** glob to match files in nested directories).

on:
  push:
    paths:
      - 'service_A/**'