diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2ed1205..7ff8437 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -82,19 +82,10 @@ jobs: echo "No previous discovery manifest (first deployment)." fi - - name: Run validation - # `just validate` runs a live data sync on fresh checkouts (no cache / - # docs mirror yet), so pass a token to avoid unauthenticated rate limits. - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: just validate - - - name: Refresh live release and documentation data - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: DATA_MODE=live bun run data:sync - - name: Resolve deployment base and site URL + # Resolved before validation, not after it: `just validate` is also what + # builds the site, so the base and the site URL have to be in the + # environment for that build to be the artifact that ships. id: pages-config env: REPO_NAME: ${{ github.event.repository.name }} @@ -118,13 +109,22 @@ jobs: echo "pages-base=$BASE" >> "$GITHUB_OUTPUT" echo "site-url=$SITE" >> "$GITHUB_OUTPUT" - - name: Build site with live data + - name: Run validation + # One pass: `just validate` runs the live data sync (a fresh checkout has + # no cache or docs mirror, so pass a token to avoid unauthenticated rate + # limits), builds, and runs every check. The deployment base and site URL + # are in the environment, so the build it produces is the one that is + # uploaded and the link, SEO and dist checks see the URLs the deployment + # actually serves. This used to re-sync all data and rebuild the site + # afterwards, with nothing in between to invalidate the first result. + # # The build never receives the IndexNow key: the key verification file is # written from the secret by a separate step below (see docs/discovery.md). env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PAGES_BASE: ${{ steps.pages-config.outputs.pages-base }} SITE_URL: ${{ steps.pages-config.outputs.site-url }} - run: bun run build + run: just validate - name: Write the IndexNow key verification file # The key is supplied only by the INDEXNOW_KEY repository secret and is diff --git a/README.md b/README.md index 9c163d8..063adcf 100644 --- a/README.md +++ b/README.md @@ -565,8 +565,10 @@ Do not try to force the GitHub toggle on: it would require temporarily setting the Cloudflare DNS record to **DNS only** (grey cloud) so GitHub can issue the certificate, and renewals can fail again once the record is proxied. -The workflow validates (`just validate`), refreshes live release/documentation -data, builds, and uploads `./src/dist`. +The workflow resolves the deployment base and site URL, then runs +`just validate` once: that syncs the release and documentation data live (a +fresh checkout has no cache), builds the site with the resolved base applied, +and runs every check against it. It uploads `./src/dist`. ### Repository-dispatch integration diff --git a/justfile b/justfile index cc331bf..cb0760a 100644 --- a/justfile +++ b/justfile @@ -19,6 +19,9 @@ install: install-hooks: bunx lefthook install +# Cache-first so a recipe that runs after another sync does not re-fetch every +# release, package and documentation page a second time. `just validate` relies +# on this: its first sync is live on a fresh checkout and its build reuses it. # Refresh docs mirrors and release data (cache-first). data-sync: bun run data:sync @@ -59,8 +62,13 @@ test: test-dist: bun run test:dist -# Produce a production build (runs data sync first). -build: live-data-sync +# The data sync is cache-first: on a fresh checkout it fetches live, and +# otherwise it reuses the release cache and the docs mirror built from it, so a +# recipe that runs after another sync does not re-fetch everything a second +# time. Run `just live-data-sync` first when a build must use freshly fetched +# data. +# Produce a production build (dependency: data sync). +build: data-sync bun run build # Full CI validation chain used by the shared build pipeline (data sync → typecheck → build → checks). diff --git a/skills/site-validation-loop/SKILL.md b/skills/site-validation-loop/SKILL.md index 56f6e26..7731a13 100644 --- a/skills/site-validation-loop/SKILL.md +++ b/skills/site-validation-loop/SKILL.md @@ -28,7 +28,7 @@ tags: | Unit tests | `just test` (`bun test tests/unit`) | Manifest/schema rules, catalogue guard, docs aggregation rules, release transform, urls, staleness, branding | | Assets | `just check-assets` | Branding sources vs generated public assets | | Catalogue | `just check-projects` | Catalogue invariants (see below) | -| Build | `just build` (runs live data sync first) | Astro/Starlight build, sidebar/llms plugin wiring | +| Build | `just build` (runs a cache-first data sync first) | Astro/Starlight build, sidebar/llms plugin wiring | | Links | `just check-links` | Broken internal links **and missing anchors** across `dist/**/*.html` | | Generated output | `just check-generated` | Docs cache/mirror agreement, release cache shape, mirrored project assets exist and are valid JSON, `llms*.txt`, sitemap, robots, no secrets/local paths | | Dist tests | `just test:dist` | Per-project LLM bundles, rendered project/use-case surfaces, footer version, SEO outputs |