Skip to content

Publish the style, samples and fonts to GitHub Pages on release - #52

Merged
HuggeK merged 9 commits into
mainfrom
fix-release-publishing
Aug 16, 2026
Merged

Publish the style, samples and fonts to GitHub Pages on release#52
HuggeK merged 9 commits into
mainfrom
fix-release-publishing

Conversation

@HuggeK

@HuggeK HuggeK commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

This PR is what publishes the site at all. The repo's Pages source is set to GitHub Actions (build_type: workflow), but the workflow that does the deploying lives here and has never been merged — so nothing has deployed since 5 July 2026. https://huggek.github.io/golfTiles/ is still serving that day's build, which is why the MapLibre v6 fix in #53 had no visible effect after merging.

It replaces the hand-synced copies in docs/ that kept going stale:

  • New publish-pages.yml workflow — runs on every push to main, on every published release, and manually via workflow_dispatch. It assembles the site from canonical sources at build time: docs/index.html, the canonical styles/golfTilesStyle.json, docs/samples/*.pmtiles and docs/fonts/, then deploys with actions/deploy-pages.
  • Self-hosted font glyphs — vendors Open Sans Regular SDF ranges into docs/fonts/, served at https://huggek.github.io/golfTiles/fonts/{fontstack}/{range}.pbf. GitHub Pages sends Access-Control-Allow-Origin: *, so the same URL keeps working once golftiles.org serves the style.
  • Deletes the stale docs/styles/golfTilesStyle.json — the workflow publishes the canonical style instead, rewriting its pmtiles source URL and its glyphs URL to the Pages origin with jq.
  • Modernizes docs/index.html — relative URLs, MapLibre v6, and the same pitch/navigation/terrain controls as the golftiles.org demo.

Updated since this PR was first opened

  • Merged main in, including the MapLibre v6 (ESM) migration from Migrate the demo pages to MapLibre GL JS v6 (ESM) #53. The one conflict was docs/index.html, where this branch had independently pinned maplibre-gl@5.24.0 — the same diagnosis Migrate the demo pages to MapLibre GL JS v6 (ESM) #53 reached, one major earlier. Resolved to v6's import * as maplibregl, keeping this branch's Pages-relative URLs, controls and rebranding.
  • The workflow now rewrites glyphs as well as the pmtiles URL. Previously docs/fonts/ was copied into the site but the canonical style on main declares no glyphs, so nothing ever requested those files and labels silently fell back to locally rendered glyphs. This makes the PR self-sufficient rather than depending on First version of the style: terrain, water, roads and per-course hole colors (#7) #49 landing first.
  • Glyphs regenerated from the current Open Sans and relicensed to OFL 1.1.
  • Only the 16 non-empty ranges are committed, down from 256.
Font: what changed and why

The ranges previously came from openmaptiles/fonts, which still builds the pre-2021 static Open Sans TTFs under Apache 2.0. They are now generated from current upstream — the variable ofl/opensans/OpenSans[wdth,wght].ttf in google/fonts — which has been SIL OFL 1.1 since the March 2021 release. docs/fonts/LICENSE.txt (Apache) is replaced by OFL.txt, published at /fonts/OFL.txt, and the demo page carries a visible credit.

Being a variable font buys nothing at runtime: MapLibre consumes pre-baked SDF ranges and the style spec has no font axes, so FreeType bakes the default instance (wght 400, wdth 100 = Regular) at build time. It is simply the current, correctly-licensed upstream.

256 files → 16. The clutter was never the font: 240 of the 256 ranges are ~32-byte empty stubs for scripts Open Sans does not cover. Only the 16 blocks that contain glyphs are committed. Total glyph data is about the same (~392 KB → ~429 KB — slightly up, since the new font covers two more blocks); the win is file count, not size.

A missing range 404s rather than returning an empty file. MapLibre handles both identically — one warning, then it renders that codepoint locally — and since the omitted blocks have no glyphs anyway, nothing renders differently.

Generated with MapLibre's own font-maker WASM, the engine behind https://maplibre.org/font-maker, so the output is the same as the official tool's. docs/fonts/README.md documents how to regenerate.

Why the style's pmtiles and glyphs URLs are rewritten at publish time

The canonical style points its source at pmtiles://https://golftiles.org/samples/…, but golftiles.org serves no CORS headers (the reason commit 3ff8bf0 originally forked a hand-edited copy into docs/). The workflow's jq step rewrites .sources.golfTiles_source.url to the Pages origin so the demo fetches tiles same-origin, and sets .glyphs to the ranges copied alongside.

Both rewrites leave styles/golfTilesStyle.json itself untouched, so this does not conflict with the style work on #49. The glyphs value it produces is byte-identical to the one #49 adds to the canonical style, so the two agree once #49 lands. jq also doubles as a JSON-validity gate for the style in CI.

Runbook

  1. Flip the Pages source to GitHub Actionsalready done; that is why the site is currently frozen.
  2. Merge this PR. The push to main triggers publish-pages.yml, which deploys. Every future push to main and every published release republishes.
  3. Verify https://huggek.github.io/golfTiles/ renders the map and labels.

#49 is no longer a prerequisite for labels — the glyphs rewrite above covers that. It is still needed for the terrain control (see below).

Known limitation until #49 lands

docs/index.html adds a TerrainControl bound to source terrainSource, which the canonical style on main does not define — that source arrives with #49. The button renders but would fail if clicked. Labels, tiles and everything else are unaffected.

Verification

Each page was assembled exactly as the workflow does (cp + the jq rewrites) and loaded in headless Chrome over the DevTools Protocol, served through a Range-capable server since pmtiles requires byte serving:

  • maplibre-gl.mjs, maplibre-gl-shared.mjs and maplibre-gl-worker.mjs all load; the worker comes from the CDN cross-origin via MapLibre's blob module shim.
  • pmtiles range requests succeed and tiles decode; the golf layers render.
  • /fonts/Open Sans Regular/0-255.pbf returns 200 and the Emmaboda Golfklubb label renders — previously this range was never requested at all.
  • /fonts/OFL.txt returns 200.
  • Zero console errors and zero failed requests.
  • The literal jq filter from the workflow was run through jq 1.8.2 against the canonical style.
Pre-existing issue seen while testing, not addressed here

layers[tees_borders].paint.line-color: Could not parse color from value 'yellow;red' Falling back to rgba(0,0,0,1) — looks like a raw OSM multi-value tag reaching the style. It renders black today. Left for a separate PR since it belongs to the style work.

🤖 Generated with Claude Code

claude and others added 4 commits July 5, 2026 23:53
256 prebuilt SDF glyph .pbf ranges (783 KB) from the openmaptiles/fonts project, served from GitHub Pages at /golfTiles/fonts/{fontstack}/{range}.pbf. The style's new top-level glyphs property (PR #49) points here, which finally lets the symbol layers draw text. Also ignore the _site/ staging directory used by the publishing workflow.

Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
New publish-pages.yml workflow (release: published + workflow_dispatch) assembles the site at build time: docs/index.html, docs/samples/*.pmtiles, docs/fonts/ and the canonical styles/golfTilesStyle.json with its pmtiles source URL rewritten to the Pages origin (golftiles.org serves no CORS headers, the reason docs/ previously kept a hand-edited copy). Requires the repo Pages source to be switched to 'GitHub Actions' once.

Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
docs/index.html now matches the golftiles.org demo (pinned maplibre-gl 5.24.0, pitch 70, navigation and terrain controls) and uses relative URLs served by the publishing workflow. docs/styles/golfTilesStyle.json is deleted: the workflow publishes the canonical styles/golfTilesStyle.json instead, so the copy can no longer go stale.

Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
claude and others added 5 commits July 6, 2026 00:01
The browser tab title and heading said golfTiles.org, but this page is the GitHub Pages demo; it now uses the project name and states its own https://huggek.github.io/golfTiles/ URL, keeping golftiles.org as the main-domain link.

Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
Brings the v6 (ESM) demo migration from main into this branch. The only
conflict was docs/index.html, where this branch had pinned maplibre to
5.24.0 and main has since moved to the v6 ESM import; resolved in favour
of main's v6 import, keeping this branch's Pages-relative URLs, terrain
and navigation controls, and rebranding.

Also point the published style at the glyph ranges this branch commits.
docs/fonts/ was being copied into the site but styles/golfTilesStyle.json
declares no 'glyphs' key, so nothing ever requested those 256 files and
labels fell back to locally rendered glyphs. The rewrite happens in the
same jq step that already rewrites the pmtiles source URL, so the
canonical style file stays untouched and does not conflict with the style
work on 7-write-the-first-version-of-the-style.

Verified by assembling the site exactly as the workflow does and loading
it in headless Chrome over a Range-capable server: tiles render, no
console errors or failed requests, and /fonts/Open Sans Regular/0-255.pbf
is fetched with 200 instead of warning about a missing glyph range.

Note for a follow-up: docs/index.html adds a TerrainControl bound to
source 'terrainSource', which the canonical style on main does not define
- that source arrives with the style branch. The control renders but
would fail if clicked until that branch lands.

Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
The previous commit made the committed glyph ranges actually load, which
means the site now redistributes work derived from the Open Sans font
files. Apache 2.0 section 4(a) asks that recipients get a copy of the
licence, and only the repo README mentioned it - nothing was served.

Ship a verbatim copy as docs/fonts/LICENSE.txt. publish-pages.yml already
copies the whole docs/fonts/ directory, so it lands at /fonts/LICENSE.txt
on the site, and the demo page now carries a visible credit linking to it.

Confirmed the licence applies rather than assuming it: openmaptiles/fonts
builds its Open Sans ranges from the older static TTFs and ships an
'Apache License.txt' beside them. Upstream Open Sans was relicensed to SIL
OFL 1.1 in March 2021 when it became a variable font, so anyone
regenerating these ranges from current upstream has to switch the licence.
That caveat is recorded in docs/fonts/README.md.

Verified by rebuilding the site the way the workflow does: /fonts/LICENSE.txt
serves 200, the glyph range still loads, and the page renders clean.

Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
Two separate things, since the brief conflated them: switching fonts does
not reduce the file count, and pruning does not require switching fonts.

Font: regenerated from the current upstream Open Sans, the variable
ofl/opensans/OpenSans[wdth,wght].ttf in google/fonts, which has been
SIL OFL 1.1 since the March 2021 release. The previous ranges came from
openmaptiles/fonts, which still builds the pre-2021 static TTFs under
Apache 2.0. docs/fonts/LICENSE.txt (Apache) is replaced by OFL.txt, and
the page credit now names the OFL and the Open Sans Project Authors.

Being variable buys nothing at runtime: MapLibre consumes pre-baked SDF
ranges and its style spec has no font axes - text-font is just a list of
names joined into a fontstack. FreeType bakes the default instance
(wght 400, wdth 100 = Regular), so the axes are flattened at build time.
font-maker emits all 256 ranges either way.

File count: the clutter was never the font, it was that 240 of the 256
ranges are ~32-byte stubs for scripts Open Sans does not cover. Only the
16 ranges that actually contain glyphs are committed: 256 files/787K
becomes 16 files/466K. A missing range 404s rather than returning an
empty file, and MapLibre handles both by warning once and rendering that
codepoint locally, so nothing renders differently.

Generated with MapLibre's own font-maker WASM (the engine behind
maplibre.org/font-maker) driven headlessly, so no new tooling was
installed. The stack name comes out as 'Open Sans Regular', matching
text-font in both the main and style-branch versions of the style.

Verified by assembling the site as publish-pages.yml does and loading it:
/fonts/Open Sans Regular/0-255.pbf serves 200 and the Emmaboda Golfklubb
label renders, with no errors or failed requests.

Co-authored-by: HuggeK <48095810+HuggeK@users.noreply.github.com>
@HuggeK
HuggeK marked this pull request as ready for review August 16, 2026 19:22
@HuggeK
HuggeK merged commit abdc225 into main Aug 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants