How to Set Up a Monorepo Pipeline in Bitbucket Pipelines
Bitbucket runs a step only when relevant files change using the condition.changesets.includePaths key.
Add a condition: to a step with changesets.includePaths globs. The step is skipped unless the push changed a file matching one of those paths - the core monorepo lever.
Per-component change condition
Each component step runs only when files under its path changed.
bitbucket-pipelines.yml
pipelines:
default:
- parallel:
- step:
name: API
image: node:20
condition:
changesets:
includePaths:
- 'packages/api/**'
script:
- cd packages/api && npm ci && npm test
- step:
name: Web
image: node:20
condition:
changesets:
includePaths:
- 'packages/web/**'
script:
- cd packages/web && npm ci && npm run buildGotchas
includePathsglobs are evaluated against the commits in the push; the first build of a branch may run everything.- A step skipped by
conditionis shown as skipped - it does not fail, but downstream steps that need its artifacts will miss them. - Use
for recursive matches (packages/api/); a single*does not match nested files.
Related guides
How to Set Up a Monorepo Pipeline in GitHub ActionsSet up a monorepo pipeline in GitHub Actions that builds only changed packages, using a change-detection job…
How to Run Parallel Steps in Bitbucket PipelinesRun steps in parallel in Bitbucket Pipelines with the parallel: keyword to fan out test and lint steps and cu…