Publish the style, samples and fonts to GitHub Pages on release#52
Draft
HuggeK wants to merge 6 commits into
Draft
Publish the style, samples and fonts to GitHub Pages on release#52HuggeK wants to merge 6 commits into
HuggeK wants to merge 6 commits into
Conversation
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>
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>
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.
Summary
Fixes publishing of the style and the example
.pmtilesto GitHub Pages when creating a release, replacing the hand-synced copies indocs/that kept going stale:publish-pages.ymlworkflow — runs on every push tomainand on every published release (and manually via workflow_dispatch). It assembles the site from canonical sources at build time:docs/index.html, the canonicalstyles/golfTilesStyle.json,docs/samples/*.pmtilesanddocs/fonts/, then deploys withactions/deploy-pages.Open Sans RegularSDF ranges (783 KB total, from the openmaptiles/fonts project) intodocs/fonts/, served athttps://huggek.github.io/golfTiles/fonts/{fontstack}/{range}.pbf. The style's new top-levelglyphsproperty (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 sendsAccess-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).docs/styles/golfTilesStyle.json— the workflow publishes the canonical style instead, rewriting its pmtiles source URL to the Pages origin withjq.docs/index.html— pinnedmaplibre-gl@5.24.0, relative URLs, and the same pitch/navigation/terrain controls as the golftiles.org demo.Runbook (after approving 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.mainpublishes the site automatically. Every future push tomainand every published release republishes it.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 intodocs/). The workflow'sjqstep rewrites.sources.golfTiles_source.urlto the Pages origin, so the demo fetches tiles same-origin.jqalso 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:/docsbuild, that build republishes adocs/folder whosestyles/golfTilesStyle.jsonwas 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 (orgh workflow run publish-pages.yml). A nice side effect of vendoring the fonts underdocs/: 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
cp+ thejqrewrite, via node on Windows): the rewritten style parses,.sources.golfTiles_source.urlbecomespmtiles://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._site/locally: page, style and glyph ranges all return 200; the vendored0-255.pbfis byte-identical (74,696 bytes) to the upstreamfonts.openmaptiles.orgcopy.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, sincepush/release/workflow_dispatchruns of this workflow only happen from the default branch.🤖 Generated with Claude Code