Skip to content

Commit c1d6ec5

Browse files
committed
Consume shared Antora UI bundle from wincon-antora-ui release
The UI bundle source this repo carried has been extracted into wintermeyer/wincon-antora-ui. That repo builds and publishes ui-bundle.zip to a `latest` release on every main push; both this book and learn-ruby-on-rails-book now pull the bundle from that URL, so the chrome stays in lockstep without copy-paste. Changes here: - antora-playbook.yml / antora-local-playbook.yml replaced the `./ui-bundle/build/ui-bundle.zip` reference with the release URL at github.com/wintermeyer/wincon-antora-ui. Both gain `ui.supplemental_files: ./ui-supplemental` so Antora overlays per-book header/footer-content.hbs on top of the bundle defaults. - scripts/fetch-partials.sh now writes under ui-supplemental/ (gitignored). The Phoenix nav gets data-book-current="phoenix" stamped in. - scripts/deploy.sh loses the `npm run build` inside ui-bundle/ — the bundle is ready-made — plus a comment clarifying what `antora --fetch` does now that the UI comes from a URL. - The vendored ui-bundle/ directory is removed. - README rewritten; the contributing flow is now "edit the shared UI bundle repo and push" rather than "edit this repo's ui-bundle subtree". Builds pre/post are visually identical (both books already used a byte-identical copy of this bundle); the value is in the delete.
1 parent 0be166f commit c1d6ec5

64 files changed

Lines changed: 118 additions & 3273 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ sandbox/*
77
/docs-site
88
.vscode
99
/ignore/
10+
# Generated at deploy time by scripts/fetch-partials.sh.
11+
/ui-supplemental/

README.md

Lines changed: 59 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,82 @@
11
# Elixir, Phoenix and Ash Beginner's Guide
22

33
Content is authored in AsciiDoc under `modules/ROOT/pages/` and rendered
4-
by [Antora](https://antora.org). The visual style matches
5-
[wintermeyer-consulting.de](https://wintermeyer-consulting.de) and is
6-
produced by a custom Tailwind CSS v4 UI bundle that lives in
7-
`ui-bundle/`.
4+
by [Antora](https://antora.org). The visual chrome (Tailwind v4 theme,
5+
sidebars, pagination, TOC) comes from the shared UI bundle at
6+
[`wintermeyer/wincon-antora-ui`](https://github.com/wintermeyer/wincon-antora-ui),
7+
which is also used by the Rails book at `/rails/book/`.
88

99
## Build
1010

11-
The site build is two steps: first build the UI bundle, then run Antora.
12-
1311
```sh
14-
# 1. Build the UI bundle (produces ui-bundle/build/ui-bundle.zip)
15-
cd ui-bundle
16-
npm install
17-
npm run build
18-
cd ..
19-
20-
# 2. Render the site against the local source (build/site/)
21-
npx antora --fetch antora-local-playbook.yml
12+
npm install # installs Antora
13+
npx antora --fetch antora-local-playbook.yml # renders build/site/
2214
```
2315

24-
Open `build/site/index.html` in a browser to preview.
16+
`--fetch` refreshes both the content source and the UI bundle
17+
(pulled from the `latest` release of wincon-antora-ui). Open
18+
`build/site/index.html` to preview.
2519

26-
To render the production playbook (pulls content from the remote repo
27-
instead of the working directory), swap step 2 for:
20+
To render against the main branch on GitHub instead of the local
21+
working copy:
2822

2923
```sh
3024
npx antora --fetch antora-playbook.yml
3125
```
3226

33-
## UI bundle development
34-
35-
Work on the chrome and styles lives in `ui-bundle/src/`:
27+
## UI bundle changes
3628

37-
- `css/site.css` — Tailwind v4 source (`@theme` tokens, `@custom-variant
38-
dark`, and `@apply`-scoped rules for Antora's class surface)
39-
- `partials/header-content.hbs`, `partials/footer-content.hbs` — the
40-
wincon-matching top nav and four-column footer. These are the
41-
*committed fallbacks*; the real canonical versions live in
42-
[wincon/priv/static/partials/](https://github.com/wintermeyer/wincon/tree/main/priv/static/partials)
43-
and are pulled in by `scripts/fetch-partials.sh` at deploy time
44-
(with `data-book-current="phoenix"` stamped into the nav).
45-
- `partials/*.hbs`, `layouts/*.hbs`, `helpers/*.js`, `js/site.js`,
46-
`img/*.svg` — carried from the Antora default UI so Antora's internal
47-
plumbing and sidebar JS keep working
29+
Edit `src/` in
30+
[wintermeyer/wincon-antora-ui](https://github.com/wintermeyer/wincon-antora-ui)
31+
and push to main. A GitHub Actions workflow rebuilds `ui-bundle.zip`
32+
and re-uploads it to the `latest` release in ~30 seconds. The next
33+
deploy of this book (or of the Rails book) picks it up.
4834

49-
For a tight iteration loop:
35+
For a tight local loop while editing the bundle, point this repo's
36+
playbook at the UI bundle checkout:
5037

51-
```sh
52-
cd ui-bundle
53-
npm run dev # Tailwind CLI in watch mode
54-
# then, in another shell, rebuild the bundle + site on demand
55-
npm run build && cd .. && npx antora --fetch antora-local-playbook.yml
38+
```yaml
39+
ui:
40+
bundle:
41+
url: /path/to/wincon-antora-ui/build/ui-bundle.zip
42+
snapshot: true
5643
```
5744
58-
Dark mode follows the OS `prefers-color-scheme`; there is no toggle.
45+
## Per-book chrome override
46+
47+
`scripts/fetch-partials.sh` pulls the canonical nav + footer from
48+
[`wincon/priv/static/partials/`](https://github.com/wintermeyer/wincon/tree/main/priv/static/partials),
49+
stamps `data-book-current="phoenix"` into the nav, and drops the files
50+
into `ui-supplemental/partials/`. Antora's `ui.supplemental_files`
51+
overlay then overrides the default `header-content.hbs` and
52+
`footer-content.hbs` shipped with the UI bundle. The `ui-supplemental/`
53+
directory is gitignored — it's generated at every deploy.
5954

6055
## Deployment
6156

62-
Pushing to `main` triggers `.github/workflows/deploy.yml`, which runs on
63-
a self-hosted runner (label `eliph`) on bremen2. The runner checks the
64-
repo out, runs `scripts/deploy.sh`, and publishes the rendered site to
65-
`/var/www/elixir-phoenix-ash/releases/<timestamp>/`. An atomic symlink
66-
swap makes `/var/www/elixir-phoenix-ash/current/` point at the new
67-
release. The last five releases are kept.
68-
69-
`scripts/deploy.sh` calls `scripts/fetch-partials.sh` first, which
70-
pulls the canonical nav/footer HTML from wincon (production → GitHub
71-
raw fallback) and overwrites `ui-bundle/src/partials/{header,footer}-content.hbs`
72-
before the UI bundle is built. A fetch failure is non-fatal: the
73-
committed copies are used as-is.
74-
75-
Nginx serves the site under
76-
<https://wintermeyer-consulting.de/phoenix/book/> via two location
77-
blocks on the `wintermeyer-consulting.de` vhost (one for pages, one for
78-
`antora-assets/`). The old domain <https://elixir-phoenix-ash.com>
79-
returns a path-preserving 301 to the new location.
57+
Pushing to `main` triggers `.github/workflows/deploy.yml`, which runs
58+
on the self-hosted runner (label `eliph`) on bremen2. The runner
59+
checks the repo out, runs `scripts/deploy.sh`, and publishes the
60+
rendered site to `/var/www/elixir-phoenix-ash/releases/<timestamp>/`.
61+
An atomic symlink swap makes `/var/www/elixir-phoenix-ash/current/`
62+
point at the new release. The last five releases are kept.
63+
64+
`scripts/deploy.sh`:
65+
66+
1. Activates mise (Node 20 pinned in `.tool-versions`).
67+
2. Calls `scripts/fetch-partials.sh` to pull the canonical nav/footer.
68+
3. Runs `npm ci` and `npx antora --fetch antora-playbook.yml`.
69+
4. Copies `build/site/` into the new release dir and swaps the
70+
`current` symlink.
71+
5. Prunes old releases (keeps last 5).
72+
73+
A fetch failure in step 2 is non-fatal: Antora silently falls back to
74+
the UI bundle's default partials (with an empty `data-book-current`).
75+
76+
## Nginx
77+
78+
The site is served under <https://wintermeyer-consulting.de/phoenix/book/>
79+
via two location blocks on the `wintermeyer-consulting.de` vhost (one
80+
for pages, one for `antora-assets/`). The old domain
81+
<https://elixir-phoenix-ash.com> returns a path-preserving 301 to the
82+
new location.

antora-local-playbook.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ content:
1212

1313
ui:
1414
bundle:
15-
url: ./ui-bundle/build/ui-bundle.zip
15+
url: https://github.com/wintermeyer/wincon-antora-ui/releases/download/latest/ui-bundle.zip
1616
snapshot: true
17+
supplemental_files: ./ui-supplemental
1718
output_dir: antora-assets
1819
runtime:
1920
fetch: true

antora-playbook.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ content:
1111

1212
ui:
1313
bundle:
14-
url: ./ui-bundle/build/ui-bundle.zip
14+
url: https://github.com/wintermeyer/wincon-antora-ui/releases/download/latest/ui-bundle.zip
1515
snapshot: true
16+
supplemental_files: ./ui-supplemental
1617
output_dir: antora-assets
1718
runtime:
1819
fetch: true

scripts/deploy.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ log "Repo: ${REPO_DIR}"
3838
log "Fetching latest nav + footer partials from wincon..."
3939
./scripts/fetch-partials.sh
4040

41-
log "Building UI bundle..."
42-
( cd "${REPO_DIR}/ui-bundle" && npm ci --no-audit --no-fund && npm run build )
43-
4441
log "Installing Antora..."
4542
( cd "${REPO_DIR}" && npm ci --no-audit --no-fund )
4643

4744
log "Rendering site..."
45+
# --fetch refreshes both the content source (this repo) and the UI
46+
# bundle (wincon-antora-ui/releases/latest/ui-bundle.zip). The UI
47+
# bundle's snapshot:true in the playbook tells Antora not to cache
48+
# across runs, so a fresh bundle is always pulled.
4849
( cd "${REPO_DIR}" && npx antora --fetch antora-playbook.yml )
4950

5051
if [ ! -d "${REPO_DIR}/build/site/book" ]; then

scripts/fetch-partials.sh

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
#!/usr/bin/env bash
2-
# Fetch the canonical nav + footer partials from wincon and overwrite
3-
# the Antora UI-bundle header-content.hbs / footer-content.hbs before
4-
# the UI bundle is built.
2+
# Fetch the canonical nav + footer partials from wincon and write them
3+
# into ./ui-supplemental/partials/ so Antora overrides the default
4+
# header-content.hbs / footer-content.hbs from the shared UI bundle
5+
# (wintermeyer/wincon-antora-ui) with book-specific content.
56
#
67
# Source of truth: https://wintermeyer-consulting.de/partials/
78
# (served from wincon/priv/static/partials/).
89
#
910
# Falls back to the GitHub raw URL when production is unreachable.
1011
#
11-
# On fetch failure, keeps the committed .hbs files so deploys never
12-
# break on a transient network issue.
12+
# On total failure the supplemental files are left at whatever state
13+
# the previous run put them in (or absent on first deploy), so Antora
14+
# silently falls back to the bundle defaults. Deploys never break on
15+
# a transient wincon outage.
1316

1417
set -u
1518

@@ -19,7 +22,8 @@ BOOK_CURRENT="phoenix"
1922

2023
cd "$(dirname "$0")/.."
2124

22-
PARTIALS_DIR="ui-bundle/src/partials"
25+
PARTIALS_DIR="ui-supplemental/partials"
26+
mkdir -p "${PARTIALS_DIR}"
2327

2428
try_fetch() {
2529
local source_name="$1"

ui-bundle/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)