Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ jobs:
run: npm run build && npm run linkcheck

- name: lip demo (VitePress-style, folder locales)
run: npm run build:lip && node kit/scripts/linkcheck.mjs dist-lip --base /lip/ --site-origin https://docs.levimc.org
run: npm run build:lip && node kit/scripts/linkcheck.mjs dist-lip --base /lip/ --site-origin https://levimc.org

- name: single-locale docs demo
run: npm run build:single && node kit/scripts/linkcheck.mjs dist-single --base /Single/ --site-origin https://docs.levimc.org
run: npm run build:single && node kit/scripts/linkcheck.mjs dist-single --base /Single/ --site-origin https://levimc.org

- name: plain app demo (levimc.org / levimc.org/mods shape)
run: npm run build:app
Expand Down
283 changes: 141 additions & 142 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,142 +1,141 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- main
# LeviMC Mods (/mods/) is a snapshot of its repositories' tags (mods/repos.txt), so rebuild to pick up new
# versions.
schedule:
- cron: "17 * * * *"
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
outputs:
kit-changed: ${{ steps.kit.outputs.changed }}
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: 24
cache: npm

- run: npm ci

# levimc-kit lives here (kit/) and is published with the site at https://levimc.org/kit/v2/, where every
# other LeviMC site fetches it when it builds. --stamp puts the kit's build hash into this site's pages too.
- id: kit
run: |
node kit/scripts/publish-kit.mjs .kit/publish --stamp
new=$(jq -r .build .kit/publish/v2/manifest.json)
old=$(curl -fsSL https://levimc.org/kit/v2/manifest.json | jq -r .build || echo none)
echo "kit build: $old → $new"
echo "changed=$([ "$new" != "$old" ] && echo true || echo false)" >> "$GITHUB_OUTPUT"

- run: npm run typecheck

# Blog content (Hexo permalinks, slugs, rendering) and the kit's preference tests.
- run: npm test

# Client build, SSR build and prerender: one static HTML file per route
# (projects/index.html, …) plus 404.html, sitemap.xml and robots.txt.
- run: npm run build

- run: cp -r .kit/publish dist/kit

# LeviMC Mods: its own app in mods/ (pnpm), built with this kit and deployed at /mods/. The token lets its build
# read each package repository from GitHub's GraphQL API (renamed repositories, stars, release dates, license).
- uses: pnpm/action-setup@v5
with:
package_json_file: mods/package.json

# What earlier builds read from the mods' repositories (mods/.cache, see mods/src/server/registry.ts), so this one
# reads only new tags. Without it, everything is read again (about a minute).
- uses: actions/cache/restore@v6
with:
path: mods/.cache
key: mods-registry-${{ github.run_id }}
restore-keys: mods-registry-

- working-directory: mods
run: |
pnpm install --frozen-lockfile
pnpm build
env:
GITHUB_TOKEN: ${{ github.token }}

# Saved only when it changed (the key is its hash).
- uses: actions/cache/save@v6
with:
path: mods/.cache
key: mods-registry-${{ hashFiles('mods/.cache/registry.json') }}

# The pages and the JSON from before version 4 at /mods/, the JSON (version 4) at /api/v4/mods/, and the
# release versions (versions/versions.json, kept by versions.yml) at /api/v4/mc/versions/.
- run: |
cp -r mods/dist dist/mods
test ! -e dist/api
cp -r mods/dist-api dist/api
test ! -e dist/api/v4/mc/versions
mkdir -p dist/api/v4/mc/versions
cp versions/versions.json dist/api/v4/mc/versions/index.json

# Internal links, redirect-needing links and #anchors (GitHub Pages semantics).
- run: npm run linkcheck

- uses: actions/configure-pages@v6

- uses: actions/upload-pages-artifact@v5
with:
path: dist

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5

# A new kit is live: rebuild every other LeviMC site now, so the change reaches them within minutes. Needs the
# KIT_SYNC_TOKEN secret (a fine-grained token with "Actions: read and write" on the repositories below);
# without it, each site still picks the new kit up with its hourly check.
sync:
needs: [build, deploy]
if: needs.build.outputs.kit-changed == 'true'
runs-on: ubuntu-latest
steps:
- env:
GH_TOKEN: ${{ secrets.KIT_SYNC_TOKEN }}
run: |
if [ -z "$GH_TOKEN" ]; then
echo "::notice::KIT_SYNC_TOKEN is not set: the sites rebuild with the new kit at their next hourly check"
exit 0
fi
status=0
while read -r repo workflow; do
echo "→ $repo ($workflow)"
gh workflow run "$workflow" -R "LiteLDev/$repo" || status=1
done <<'EOF'
liteldev.github.io deploy.yml
LeviLamina build-docs.yml
LegacyScriptEngine build_docs.yml
lip build-docs.yml
LeviLauncher docs.yml
BeDD docs.yml
bedboo docs.yml
EOF
exit $status
name: Deploy to GitHub Pages

on:
push:
branches:
- main
# LeviMC Mods (/mods/) is a snapshot of its repositories' tags (mods/repos.txt), so rebuild to pick up new
# versions.
schedule:
- cron: "17 * * * *"
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
outputs:
kit-changed: ${{ steps.kit.outputs.changed }}
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: 24
cache: npm

- run: npm ci

# levimc-kit lives here (kit/) and is published with the site at https://levimc.org/kit/v2/, where every
# other LeviMC site fetches it when it builds. --stamp puts the kit's build hash into this site's pages too.
- id: kit
run: |
node kit/scripts/publish-kit.mjs .kit/publish --stamp
new=$(jq -r .build .kit/publish/v2/manifest.json)
old=$(curl -fsSL https://levimc.org/kit/v2/manifest.json | jq -r .build || echo none)
echo "kit build: $old → $new"
echo "changed=$([ "$new" != "$old" ] && echo true || echo false)" >> "$GITHUB_OUTPUT"

- run: npm run typecheck

# Blog content (Hexo permalinks, slugs, rendering) and the kit's preference tests.
- run: npm test

# Client build, SSR build and prerender: one static HTML file per route
# (projects/index.html, …) plus 404.html, sitemap.xml and robots.txt.
- run: npm run build

- run: cp -r .kit/publish dist/kit

# LeviMC Mods: its own app in mods/ (pnpm), built with this kit and deployed at /mods/. The token lets its build
# read each package repository from GitHub's GraphQL API (renamed repositories, stars, release dates, license).
- uses: pnpm/action-setup@v5
with:
package_json_file: mods/package.json

# What earlier builds read from the mods' repositories (mods/.cache, see mods/src/server/registry.ts), so this one
# reads only new tags. Without it, everything is read again (about a minute).
- uses: actions/cache/restore@v6
with:
path: mods/.cache
key: mods-registry-${{ github.run_id }}
restore-keys: mods-registry-

- working-directory: mods
run: |
pnpm install --frozen-lockfile
pnpm build
env:
GITHUB_TOKEN: ${{ github.token }}

# Saved only when it changed (the key is its hash).
- uses: actions/cache/save@v6
with:
path: mods/.cache
key: mods-registry-${{ hashFiles('mods/.cache/registry.json') }}

# The pages and the JSON from before version 4 at /mods/, the JSON (version 4) at /api/v4/mods/, and the
# release versions (versions/versions.json, kept by versions.yml) at /api/v4/mc/versions/.
- run: |
cp -r mods/dist dist/mods
test ! -e dist/api
cp -r mods/dist-api dist/api
test ! -e dist/api/v4/mc/versions
mkdir -p dist/api/v4/mc/versions
cp versions/versions.json dist/api/v4/mc/versions/index.json

# Internal links, redirect-needing links and #anchors (GitHub Pages semantics).
- run: npm run linkcheck

- uses: actions/configure-pages@v6

- uses: actions/upload-pages-artifact@v5
with:
path: dist

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5

# A new kit is live: rebuild every other LeviMC site now, so the change reaches them within minutes. Needs the
# KIT_SYNC_TOKEN secret (a fine-grained token with "Actions: read and write" on the repositories below);
# without it, each site still picks the new kit up with its hourly check.
sync:
needs: [build, deploy]
if: needs.build.outputs.kit-changed == 'true'
runs-on: ubuntu-latest
steps:
- env:
GH_TOKEN: ${{ secrets.KIT_SYNC_TOKEN }}
run: |
if [ -z "$GH_TOKEN" ]; then
echo "::notice::KIT_SYNC_TOKEN is not set: the sites rebuild with the new kit at their next hourly check"
exit 0
fi
status=0
while read -r repo workflow; do
echo "→ $repo ($workflow)"
gh workflow run "$workflow" -R "LiteLDev/$repo" || status=1
done <<'EOF'
LeviLamina build-docs.yml
LegacyScriptEngine build_docs.yml
lip build-docs.yml
LeviLauncher docs.yml
BeDD docs.yml
bedboo docs.yml
EOF
exit $status
66 changes: 66 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# The project docs moved from docs.levimc.org to levimc.org (2026-11-15)

`https://docs.levimc.org/<Project>/…` is now `https://levimc.org/<Project>/…`. The pages, their paths and their
repositories stayed as they were.

## How it works

GitHub Pages serves a project repository's site (LeviLamina, LegacyScriptEngine, lip, LeviLauncher, BeDD, bedboo)
at `/<Repo>/` below the **organisation site's** custom domain. The organisation site used to be
LiteLDev/liteldev.github.io with the domain docs.levimc.org, and levimc.org was a project site with a domain of its
own. Now this repository *is* the organisation site (renamed from `levimc.org` to `liteldev.github.io`) with the
domain levimc.org, so every project site appears at `levimc.org/<Repo>/` without any change to how it is built.

This repository took over what the old organisation site did: `legacy/` publishes the redirect pages of the retired
docs sites (`/LeviLaunchroid/`, `/preloader-android/`, `/LiteXLoader/`), and `404.html` forwards other forms of
those URLs and wrongly cased project paths (`/levilamina/` → `/LeviLamina/`).

The old organisation repository is now **LiteLDev/docs.levimc.org**, a project site with the domain
docs.levimc.org. It publishes only a page that forwards every URL to the same path, query and `#anchor` on
levimc.org (`location.replace`). That is a client-side redirect, served with status 404. For a real 301, put the `docs`
record behind Cloudflare's proxy and add a Redirect Rule: hostname equals `docs.levimc.org` → dynamic redirect
`concat("https://levimc.org", http.request.uri.path)`, 301, preserve the query string.

Things to know:

* **Project paths win.** A repository with Pages owns `/<repo name>/` on levimc.org. No route of this site may start
with a repository's name, and no repository named like a route (`blog`, `mods`, `api`, `kit`, `about`, …) may
turn Pages on. LiteLoader.NET and liteloaderbds-documentation have Pages on and appear at
`levimc.org/LiteLoader.NET/` and `levimc.org/liteloaderbds-documentation/`.
* **Same origin.** Docs and levimc.org share cookies and localStorage. levimc.org's router leaves the docs paths
alone (`isAppPath`, `src/components/SiteHeader.tsx`).
* Each project repository points its canonical URLs, sitemap and `linkcheck --site-origin` at `https://levimc.org`.

## What was done

1. Opened a PR in each project repository that changes `https://docs.levimc.org` to `https://levimc.org`:
`hostname` / `sitemap.hostname` in `docs.config.ts`, `linkcheck --site-origin`, the hourly kit check, and links
in the docs, READMEs and code.
2. Removed the domain levimc.org from LiteLDev/levimc.org's Pages and docs.levimc.org from LiteLDev/liteldev.github.io's.
3. Renamed LiteLDev/liteldev.github.io → LiteLDev/docs.levimc.org, and LiteLDev/levimc.org → LiteLDev/liteldev.github.io.
4. Set the domain levimc.org on LiteLDev/liteldev.github.io and merged LiteLDev/levimc.org#99 (this change). After the
certificate was issued, turned on *Enforce HTTPS*.
5. Set the domain docs.levimc.org on LiteLDev/docs.levimc.org and deployed its forwarding page.
6. Merged the project PRs (the docs rebuild with their new canonical URLs).

## Checks

```sh
for p in "" LeviLamina/ LeviLamina/api/ LegacyScriptEngine/ lip/ LeviLauncher/ BeDD/ bedboo/ mods/ blog/; do
curl -s -o /dev/null -w "%{http_code} https://levimc.org/$p\n" "https://levimc.org/$p"
done
curl -s https://levimc.org/LeviLaunchroid/api/hook | grep -o 'rel="canonical" href="[^"]*"'
node legacy/build.test.mjs --live # every legacy redirect target answers 200 without a redirect
curl -s https://docs.levimc.org/LeviLamina/ | grep -o 'location.replace([^)]*)'
```

Then, in Google Search Console, submit the docs sitemaps (`https://levimc.org/<Project>/sitemap.xml`; `robots.txt`
lists them too). *Change of Address* expects 301s from docs.levimc.org, so it needs the Cloudflare rule above.

## Rolling back

1. Remove the domain from LiteLDev/liteldev.github.io's Pages and from LiteLDev/docs.levimc.org's.
2. Rename LiteLDev/liteldev.github.io back to `levimc.org`, and give it the domain levimc.org again.
3. Rename LiteLDev/docs.levimc.org back to `liteldev.github.io`, revert its last commit, and set its domain to
docs.levimc.org.
4. Revert LiteLDev/levimc.org#99 and the project PRs.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ styled with the shared LeviMC design system, levimc-kit, which lives here in [`k

**levimc-kit is the one source of the LeviMC chrome** — the bar on top (Home · Projects ▾ · Mods · Blog · Community ·
About, language · theme · GitHub), the footer, the theme and the docs engine — for every LeviMC site: levimc.org
(and LeviMC Mods at levimc.org/mods/, see below), docs.levimc.org and the project docs (LeviLamina with its Doxygen API, LegacyScriptEngine, lip,
(and LeviMC Mods at levimc.org/mods/, see below) and the project docs at levimc.org/<Project>/ (LeviLamina with its Doxygen API, LegacyScriptEngine, lip,
LeviLauncher for Windows and Android). Every deploy publishes it at <https://levimc.org/kit/v2/> (`kit/scripts/publish-kit.mjs`);
the other sites fetch it when they build (`scripts/fetch-kit.mjs`, run by their package install) and never edit it.
After a deploy that changed the kit, the `sync` job rebuilds every site (with the `KIT_SYNC_TOKEN` secret: a
Expand Down Expand Up @@ -74,6 +74,10 @@ npm run smoke:kit
- `content/blog/`, `blog/`, `src/blog/` — the blog (see below)
- `prerender.mjs` — writes `dist/<route>/index.html`, `404.html`, `sitemap.xml`, `robots.txt`; modulepreloads each
page's chunk (from Vite's manifest) and a blog post's markdown chunk
- `legacy/` — the redirect pages of retired docs sites (`/LeviLaunchroid/…`, `/preloader-android/…`,
`/LiteXLoader/…`) and the forwarding map at the top of `404.html` (other forms of those URLs, and wrongly cased
project paths like `/levilamina/` → `/LeviLamina/`). `node legacy/build.mjs dist` (the last step of `npm run build`)
writes them; the table is `legacy/redirects.mjs`. They moved here from LiteLDev/liteldev.github.io with the docs.

## Blog

Expand Down Expand Up @@ -150,6 +154,15 @@ the latest release, so the history is that file: `.github/workflows/versions.yml
`node versions/update.mjs` adds the release Mojang names now, and a new one is committed and deployed. A new key is a
line in `DOWNLOADS` in `versions/update.mjs` and a list in the file. `npm test` checks the file's shape.

## Project docs

Each project's docs are published by its own repository at `levimc.org/<Project>/` (LeviLamina, LegacyScriptEngine,
lip, LeviLauncher, BeDD, bedboo): GitHub Pages serves a project repository's site below the organisation site's
domain, and this repository is the organisation site. A path that a project with Pages owns is never this site's, so
no route here may start with a repository's name. `robots.txt` lists their sitemaps; the bar and footer load them
in full (`isAppPath` in `src/components/SiteHeader.tsx`). They were at docs.levimc.org until the move described in
[MIGRATION.md](MIGRATION.md); docs.levimc.org (LiteLDev/docs.levimc.org) forwards every URL to the same path here.

## LeviChan

A small LeviChan head peeks over the top edge of the home hero's showcase card (`src/levichan/LeviChanPeek.tsx`).
Expand Down
Loading
Loading