Commit 52b6e7d
authored
chore(docs): update Netlify build configuration to use custom ignore script for docs changes (#19032)
## Summary
Adds conditional build logic to Netlify deployments for both `docs/` and
`barretenberg/docs/` sites. This prevents unnecessary doc preview builds
on PRs that don't contain documentation changes, reducing CI noise and
build costs.
## Problem
Previously, every PR triggered docs preview builds regardless of whether
documentation was changed. This caused:
- Unnecessary preview deployments on non-docs PRs
- Wasted build minutes
- Clutter in PR checks
Additionally, the previous ignore command (`git diff --quiet
$CACHED_COMMIT_REF $COMMIT_REF`) had a critical bug: when
`CACHED_COMMIT_REF` is unset (which happens on new branches), the
command becomes `git diff --quiet HEAD`, comparing the commit against
the working directory instead of another commit. In a clean clone, this
returns exit code 0 (no changes), incorrectly skipping builds that
should run.
## Solution
Implements a hybrid approach with custom ignore scripts that handle both
production and preview deployments correctly:
### Production Deploys (`next` branch)
- Uses `CACHED_COMMIT_REF` to compare against the last successfully
deployed commit
- Ensures nightly docs releases and other docs changes trigger builds
- Falls back to building if `CACHED_COMMIT_REF` is unset (first deploy
or cache reset)
### PR Preview Deploys (other branches)
- Uses `git merge-base` to compare the PR against where it diverged from
`next`
- Only builds if the PR introduces docs-related changes
- Works correctly even on first commit of new branches (no
`CACHED_COMMIT_REF` dependency)
## What Triggers a Build
### For `docs/` site:
- Changes in `docs/` directory
- Changes in `noir-projects/aztec-nr/` (source for autogenerated API
docs)
- Changes in files referenced by `#include_code` macros
### For `barretenberg/docs/` site:
- Changes in `barretenberg/docs/` directory
- Changes in `barretenberg/cpp/src/barretenberg/` (Doxygen API source)
- Changes in `barretenberg/cpp/docs/` (Doxygen config)
- Changes in files referenced by `#include_code` macros
## Behavior Matrix
| Scenario | Branch | Result |
|----------|--------|--------|
| PR with docs changes | feature-branch | **Build preview** |
| PR without docs changes | feature-branch | **Skip** (no preview
clutter) |
| Push with docs changes | next | **Build production** |
| Push without docs changes | next | **Skip** |
| First deploy (no cached ref) | next | **Build** (safe fallback) |
## Files Changed
- `docs/netlify.toml` - Updated to use custom ignore script
- `docs/scripts/netlify-ignore-build.sh` - New ignore script for main
docs
- `barretenberg/docs/netlify.toml` - Updated to use custom ignore script
- `barretenberg/docs/scripts/netlify-ignore-build.sh` - New ignore
script for BB docsFile tree
4 files changed
+166
-4
lines changed- barretenberg/docs
- scripts
- docs
- scripts
4 files changed
+166
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
| 5 | + | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
0 commit comments