Generate static deployment for GH Pages#80
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
f1bfa69 to
0a16e41
Compare
26c1a85 to
865f88d
Compare
7d882ab to
8714087
Compare
This reverts commit 6044f49.
DragaDoncila
left a comment
There was a problem hiding this comment.
Honestly this all looks pretty simple and clean to me, I don't have many comments. Do we want to do anything before merge? @aganders3 I know you mentioned trying it with plugin manager possibly?
| dest_paths.append(gh_pages_dir / "classifiers.json") | ||
| elif source_file == public_dir / "conda.json": | ||
| dest_paths.append(gh_pages_dir / "conda.json") | ||
| dest_paths.append(api_dir / "conda-map") |
There was a problem hiding this comment.
so I notice sometimes we append the path with no .json to dest_paths as well as with the .json suffix. Can you explain why that is? I guess api_dir is the pages that are actually going to be served, and gh_pages_dir is like... backup files? Why do we put them in there at all?
There was a problem hiding this comment.
It's really an attempt to provide some backward-compatibility, but perhaps we don't need it. I think it's really an accident that both https://api.napari.org/conda.json and https://api.napari.org/api/conda point to the same thing in the current implementation.
|
I tried it with the plugin manager and it worked, but I need to make sure I'm not missing any functionality. I think this is pretty safe to merge in its current form though, and that should keep the static version up to date with the next.js API. |
|
I'm going to merge and we can iterate as-needed, since having this live will allow us to do some more/better testing. |
This PR sets up a static API deployment via GitHub Pages alongside the existing Vercel/NextJS API. The Vercel API will remain in place to allow testing and grace period, and api.napari.org will continue to point to the Vercel deployment for the time being.
Changes
API Routes:
/api/conda→/api/conda-mapto avoid route conflict with/api/conda/{plugin_name}vercel.jsonso/api/condastill works (redirects to/api/conda-map)/api/condaendpoint:Deprecation: trueLink: </api/conda-map>; rel="alternate"X-Deprecated-Messageexplaining the changeStatic Deployment:
scripts/prepare_gh_pages.pyto generate static files frompublic/.jsonextensions to match API routesconda.json→conda-mapandindex.json→plugins/api/directoryindex.htmlhomepage.github/workflows/update.yml):public/changes (doesn't interfere with existing process)gh-pagesas downloadable artifact for inspection (host it locally withpython -m http.server -d ./gh-pages)gh-pagesbranch viapeaceiris/actions-gh-pages@v4Known Limitations / Breaking Changes
When using the GitHub Pages API (not applicable to Vercel API):
No name normalization - File paths are served as-is without package name normalization (known, accepted limitation previously discussed). To be clear: the names are already normalized. What this means is that clients will need to normalize names before making requests. Previously the Vercel API will accept non-normalized names, normalize them, and return the endpoint info (manifest, for example) for a plugin that matches the normalized name. Sorry I feel like I am not explaining this properly at midnight.
Breaking change for
/api/condaroute - Moved to/api/conda-mapto avoid conflict with/api/conda/{plugin_name}. The Vercel API maintains backward compatibility via rewrite, but the static API only serves/api/conda-map. This is a bummer, probably the biggest drawback here. TODO: update clients to use this new endpoint ASAP.Files are served as
text/plaininstead ofapplication/json- GitHub Pages serves files without extension astext/plain. This generally doesn't matter:Content-Typeheader at all