Skip to content

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

Draft
HuggeK wants to merge 6 commits into
mainfrom
fix-release-publishing
Draft

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

Conversation

@HuggeK

@HuggeK HuggeK commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes publishing of the style and the example .pmtiles to GitHub Pages when creating a release, replacing the hand-synced copies in docs/ that kept going stale:

  • New publish-pages.yml workflow — runs on every push to main and 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 the 256 prebuilt Open Sans Regular SDF ranges (783 KB total, from the openmaptiles/fonts project) into docs/fonts/, served at https://huggek.github.io/golfTiles/fonts/{fontstack}/{range}.pbf. The style's new top-level glyphs property (added in First version of the style: terrain, water, roads and per-course hole colors (#7) #49) points here, which finally lets the symbol layers render text. GitHub Pages sends Access-Control-Allow-Origin: *, so the same URL keeps working once golftiles.org serves the style (long-term: golftiles.org = bucket for tiles + style, GitHub Pages = demo page).
  • Deletes the stale docs/styles/golfTilesStyle.json — the workflow publishes the canonical style instead, rewriting its pmtiles source URL to the Pages origin with jq.
  • Modernizes docs/index.html — pinned maplibre-gl@5.24.0, relative URLs, and the same pitch/navigation/terrain controls as the golftiles.org demo.

Runbook (after approving this PR)

  1. Merge First version of the style: terrain, water, roads and per-course hole colors (#7) #49 first (the demo page's terrain control and the label rendering need its style).
  2. Flip the Pages source once, before merging this PR: gh api -X PUT repos/HuggeK/golfTiles/pages -f build_type=workflow (or Settings → Pages → Source → GitHub Actions). The site keeps serving the last legacy build until the first workflow deployment.
  3. Merge this PR — the push to main publishes the site automatically. Every future push to main and every published release republishes it.
  4. Verify https://huggek.github.io/golfTiles/ shows labels and terrain.
Why the style's pmtiles URL is 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. jq also doubles as a JSON-validity gate for the style in CI.

Why flip the Pages source before merging (step 2 vs 3)

If this PR merges while Pages is still on the legacy main:/docs build, that build republishes a docs/ folder whose styles/golfTilesStyle.json was just deleted — the demo map 404s on the style. And the workflow's own deploy step fails until the source is GitHub Actions. Flipping first avoids both: the site simply stays on the last legacy build until the merge-triggered workflow run replaces it. If you do merge first by accident, flip the source and re-run the failed workflow (or gh workflow run publish-pages.yml). A nice side effect of vendoring the fonts under docs/: the glyphs URL is identical under both the legacy build and the workflow deployment.

Font licensing

Open Sans is © Google, licensed under the Apache License 2.0; the prebuilt glyph ranges come from the openmaptiles/fonts project. Source and license are documented in docs/fonts/README.md, along with how to add another fontstack.

Verification

  • Replicated the workflow's assembly step locally (cp + the jq rewrite, via node on Windows): the rewritten style parses, .sources.golfTiles_source.url becomes pmtiles://https://huggek.github.io/golfTiles/samples/golfTiles_se_dk_fi.pmtiles, and the staged _site/ contains the page, 2 samples, 256 glyph ranges and the style.
  • Served the staged _site/ locally: page, style and glyph ranges all return 200; the vendored 0-255.pbf is byte-identical (74,696 bytes) to the upstream fonts.openmaptiles.org copy.
  • Workflow YAML is modeled on the existing docker-publish.yml (same trigger shape, pinned action majors, minimal permissions); the merge-triggered run in step 3 of the runbook is the end-to-end smoke test, since push/release/workflow_dispatch runs of this workflow only happen from the default branch.

🤖 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 2 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>
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