Skip to content

feat(playground): one-click Nextcloud Playground preview + PR pipeline#38

Merged
erseco merged 4 commits into
mainfrom
feat/playground-preview
Jun 6, 2026
Merged

feat(playground): one-click Nextcloud Playground preview + PR pipeline#38
erseco merged 4 commits into
mainfrom
feat/playground-preview

Conversation

@erseco
Copy link
Copy Markdown
Contributor

@erseco erseco commented Jun 6, 2026

What

Adds a blueprint.json + README badge that boot a full Nextcloud in the browser (via WebAssembly) with this app pre-installed, plus a CI pipeline that gives every PR its own one-click playground link — mirroring the mod_exelearning / moodle-playground setup.

Open in Nextcloud Playground

How

  • blueprint.json — provisions a fresh Nextcloud and installs exelearning via the playground's installApp step, landing on Files.
  • README — a "Quick test (no install)" section + badge.
  • make package-zip — same staged tree as make package but as a ZIP (the format the playground extracts in the browser). The prebuilt eXeLearning static editor is downloaded from the editor's latest release (make download-editor), not compiled.
  • .github/workflows/playground-preview.yml:
    • push to main → refresh the rolling playground prerelease asset (exelearning.zip) the badge points at.
    • pull_request (same-repo) → publish a per-PR prerelease (playground-pr-<N>) and post a sticky comment with a one-click link (blueprint inlined as URL-safe base64, so no per-PR file hosting).
    • PR closed → delete the per-PR prerelease + tag.

Why a build (not the source archive)

mod_exelearning can point the playground at a GitHub source archive because Moodle plugins run from source. Here js/*.js is git-ignored — the compiled Vue/webpack bundle isn't in the repo — so the preview must build the app and host the artifact. Hosting uses GitHub Releases (prereleases), so no extra infra (Pages, third-party) is needed.

⚠️ Depends on / ordering

Requires the installApp blueprint step: ateeducacion/nextcloud-playground#1. The badge starts working once both PRs are merged, the playground redeploys to GitHub Pages, and a playground prerelease with exelearning.zip exists (created by the first push to main after merge).

Caveats

  • The viewer relies on a scoped Service Worker; some viewer features may be limited inside the playground's own Service Worker. Core install, Files and the app UI work.
  • The editor bundle makes the ZIP ~20 MB; it downloads on boot (uncached for PR previews).
  • Fork PRs are skipped (read-only token can't publish the preview release).

Test

  • make package-zip PACKAGE_VERSION=preview builds a valid ZIP with exelearning/ as the single top-level dir and the version stamped. ✅
  • jq transform + URL-safe base64 ↔ playground decoder roundtrip verified. ✅

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 6, 2026

▶️ Preview this PR in the Nextcloud Playground

Open this PR in the Nextcloud Playground

A fresh Nextcloud boots in your browser with this branch's exelearning app installed and enabled (log in as admin / admin, then upload an .elpx in Files).

Built artifact: exelearning.zip on the playground-pr-38 prerelease.

The viewer relies on a scoped Service Worker; some viewer features may be limited inside the playground's own Service Worker. Core install, Files and the app UI work.

erseco added 3 commits June 6, 2026 08:21
Add a `blueprint.json` and README badge that boot a full Nextcloud in the
browser with this app pre-installed, mirroring the mod_exelearning /
moodle-playground setup.

Because the Nextcloud app ships a compiled `js/` bundle that is not in git,
the source archive can't be used directly: the preview must build the app.
`make package-zip` produces the ZIP the playground's `installApp` step
extracts (the prebuilt eXeLearning static editor is downloaded, not compiled,
via `make download-editor`).

`playground-preview.yml`:
- push to main -> refresh the rolling `playground` prerelease asset
  (exelearning.zip) the README badge points at.
- pull_request -> publish a per-PR prerelease and post a one-click playground
  link (inline base64 blueprint) as a sticky comment.
- PR closed -> delete the per-PR prerelease and tag.

Requires the matching `installApp` blueprint step in ateeducacion/nextcloud-playground.
GitHub release-asset downloads redirect to Azure Blob with no
Access-Control-Allow-Origin header, so the playground's cross-origin
fetch was rejected. Route the installApp URL through the shared zip-proxy
worker (?repo&release&asset), which adds CORS headers.
installApp + app:enable alone leave Nextcloud unaware of the .elpx
extension, so the viewer never triggers (the file opens as a download).
Replicate what `make up` does: write config/mimetypemapping.json and
config/mimetypealiases.json (via the playground writeFile step) then run
maintenance:mimetype:update-js / update-db --repair-filecache.

Needs the writeFile step in nextcloud-playground.
@erseco erseco force-pushed the feat/playground-preview branch from bd844c9 to 177ba70 Compare June 6, 2026 07:27
…ontent

Add propiedades.elpx to tests/fixtures (the larger styles/cataloguing
sample is already there) and have the blueprint download both into the
admin user's Files (exelearning-samples/) via the playground writeFile
`url` source, then files:scan so they appear ready to click.

The PR preview rewrites the fixture refs from raw main to the PR head
commit so a branch's fixture changes show up in its preview.

Needs the writeFile `url` support in nextcloud-playground.
@erseco erseco merged commit 9c970d3 into main Jun 6, 2026
16 checks passed
@erseco erseco deleted the feat/playground-preview branch June 6, 2026 07:44
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.

1 participant