Skip to content

Latest commit

 

History

History
34 lines (21 loc) · 3.33 KB

deployment.md

File metadata and controls

34 lines (21 loc) · 3.33 KB

GitHub Pages

The site is a static build of the TSMeTTa workspace. It needs no application server.

npm ci
npm run site
node tools/serve.mjs dist/site 8733

dist/site contains index.html, workspace.js, workspace-worker.js, TSMeTTa's matching _runtime directory, fonts, and licence notices. Its examples/ directory carries the runnable sources, provenance and upstream license notices linked from THIRD-PARTY-NOTICES.md. Keep them together. Runtime URLs resolve relative to the page, including under /MeTTa-Grapher/. A custom content security policy must allow the same-origin worker and WebAssembly runtime.

Workspaces are retained for the lifetime of the browser tab. Export source through Share before a reload or deployment refresh; there is no browser-storage migration. The example source is bundled from examples/ on every build. The catalog's opening flags select the initial nine programs independently of the chooser and README exports; adding a lesson does not add startup evaluations.

The export panel keeps the reader's export choices in the browser's local storage under mettagrapher.export, and nothing else is stored there. A value the page cannot read is replaced by the defaults, with a notice. Where the browser refuses storage, the choices last until the tab closes. The video encoder is a separate file, workspace-video.js, loaded only when a video is asked about, so a deployment serves it beside workspace.js.

The Pages workflow builds the site and publishes dist/site to the gh-pages branch, replacing what the branch held with a single commit. It runs on this machine under act, in Docker, and never on GitHub's runners: nothing triggers it but a dispatch. From a clean checkout of main, since act copies the working tree into its container:

GITHUB_TOKEN="$(gh auth token)" act workflow_dispatch -W .github/workflows/pages.yml \
  -s GITHUB_TOKEN -P ubuntu-latest=catthehacker/ubuntu:act-24.04

-s GITHUB_TOKEN reads the token from the environment, so it never stands on the command line. It needs the repo scope to push the branch.

Pages serves the gh-pages branch from its root, set once under Settings → Pages → Build and deployment → Source → Deploy from a branch. GitHub then deploys each push to that branch itself, and the site is at mestto.github.io/MeTTa-Grapher. The site is public while the repository is private: anyone with its address can open it, and its scripts are the workspace as built.

To validate the published layout locally, run node tools/workspace-page.mjs --check --site after npm run site. This serves the actual artifact under /MeTTa-Grapher/ and checks engine boot, editing, exports, graph movement, keyboard controls, and narrow screens in Chrome. Set METTAGRAPHER_CHROME if Chrome is not in a standard system location. The check keeps Chrome's profile in the checkout's ai-tmp/, and its socket and shared memory in $XDG_RUNTIME_DIR, or the system temp directory where that is unset.

To roll back a deployment, check out the commit to publish and run the workflow again.

Package name

The Node package and its command are named mettagrapher. Build with npm run build before importing the checkout. The package has not been published to a registry.