Commit 2d7cf72
ci: keep gh-pages small to avoid bloating clones (#365)
## Why
The `gh-pages` branch had grown to **811 commits / ~147 MB packed**
because every docs deploy (`mike deploy dev` on each merge, a version
dir per release, per-PR previews) commits a full copy of the built site
and nothing ever reclaims that history. A default `git clone` pulls
**all** branches, so every contributor was downloading ~150 MB even
though only `main` (~11 MB) is needed for development.
The history has already been purged out-of-band (gh-pages rebuilt as a
single orphan commit; full pre-purge site archived to the
[`docs-archive-2026-07-10`](https://github.com/QuEraComputing/bloqade/releases/tag/docs-archive-2026-07-10)
release). **Fresh clone dropped ~152 MB → ~29 MB.** This PR adds the
guards so it doesn't creep back.
## What
- **`.github/workflows/squash-gh-pages.yml`** (new) — monthly +
`workflow_dispatch` job that collapses `gh-pages` to a single orphan
commit. Safe: the branch is a generated artifact and every version is
rebuildable from its release tag.
- **`.github/workflows/pub_doc.yml`** — after each release deploy, prune
the live site to `dev` + the newest **3** releases (`KEEP_RELEASES`).
Older versions remain rebuildable from tags and archived in the release
asset.
- **`.github/scripts/select_old_doc_versions.py`** (new) — small,
unit-tested stdin→stdout filter that picks which versions to delete
(handles semver ordering, e.g. `v0.10.0` > `v0.9.0`).
- **Shared `gh-pages-write` concurrency group** across the dev deploy,
release deploy, and squash job so concurrent pushes can't clobber the
branch. `cancel-in-progress: false` (cancelling a mike push mid-flight
could corrupt gh-pages).
## Notes / follow-ups
- `cancel-in-progress` on the dev-docs deploy changes from `true` →
`false`: rapid merges to `main` now queue sequential dev deploys instead
of cancelling the older one. The monthly squash reclaims the extra
commits.
- The pr-preview workflow (`doc.yml`) is intentionally left out of the
shared lock to preserve its per-PR cancel behaviour; it already races
mike deploys today (pre-existing) and the monthly squash runs at a quiet
time (03:00 UTC on the 1st).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 4f3b7fb commit 2d7cf72
4 files changed
Lines changed: 118 additions & 4 deletions
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | | - | |
9 | | - | |
| 11 | + | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
12 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | | - | |
9 | | - | |
| 12 | + | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 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 | + | |
0 commit comments