ci: publish the docs site to Pages instead of discarding the build - #19
Merged
Conversation
The `docs` job ran `npm run build` and stopped. Nothing was uploaded and nothing was deployed, so the URL the site declares in docusaurus.config.ts (shubham030.github.io/moth) has always 404'd — the documentation linked from the README has never been reachable. - `docs` now uploads website/build as a Pages artifact on every run, pull requests included, so a deploy can only ship bytes that job checked. - A separate `deploy-docs` job publishes, gated on push-to-main. Building and publishing stay separate: a PR proves the site still compiles (onBrokenLinks is 'throw', so a dead link fails there) without touching what readers see. - `concurrency: pages` with cancel-in-progress false, so two pushes queue rather than race and the last commit on main is what ends up live. - configure-pages runs with enablement, which creates the Pages site on the first run and is a no-op after — publishing needs no click in Settings. Pages on a private repository requires a paid plan. This repo is public, so the free tier covers it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
The
docsjob builds the documentation site and throws it away. Nothing isuploaded, nothing is deployed — so
https://shubham030.github.io/moth/, theURL the site declares for itself in
website/docusaurus.config.ts, returns404. Every docs link in the README points at a page that has never existed.
Found while checking what a first-time reader actually sees when they follow
the links from the repo.
What changed
docsuploads the built site as a Pages artifact, on every runincluding pull requests. The deploy job can therefore only publish bytes
that this job already built and checked.
deploy-docsjob, gated onpushtomain. Building andpublishing stay separate deliberately: a PR proves the site still compiles
—
onBrokenLinks: 'throw'means a dead link fails there — withoutreplacing what readers see.
concurrency: pages,cancel-in-progress: falseso two pushes queueinstead of racing, and the last commit on main is what ends up live.
configure-pageswithenablement: truecreates the Pages site on thefirst run and is a no-op afterwards, so publishing needs no manual step in
Settings.
Scoped to
.github/workflows/ci.yml; no other file is touched.Test plan
make teston this branch: 84/84 passing,render perf: all budgets held, serial PTY round-trip exact. Unaffected by this change, but recordedsince the
testjob shares the workflow file.yaml.safe_loadresolves three jobs (test,docs,deploy-docs) with the intendedneeds,if,permissionsandconcurrencykeys.the
ifguard excludespull_request. Verification is the first push tomainafter merge:deploy-docsshould go green andhttps://shubham030.github.io/moth/should return 200.Note
GitHub Pages on a private repository needs a paid plan. This repo is public,
so the free tier covers it — but the deploy would have failed silently while
it was private, which is worth knowing if visibility ever changes back.