修改 GitHub Pages 上托管的 JupyterLite 网站#

注意

本指南假设您已在 GitHub Pages 上托管了一个 JupyterLite 网站。

如果不是,请查看快速入门指南,了解如何在 GitHub Pages 上部署 JupyterLite。

修改网站#

如果依赖项列在 requirements.txt 文件中,请编辑该文件以进行更改。

例如,假设您想在部署中添加 jupyterlab-night 主题。打开 requirements.txt 并添加以下行:

# other dependencies for building the JupyterLite website
jupyterlite-core
# ...

# add the jupyterlab-night theme
jupyterlab-night

打开拉取请求#

完成更改后,提交更改并将其推送到 GitHub。

然后打开一个新的拉取请求。打开拉取请求将触发 JupyterLite 网站的新构建,并生成静态资产,这些资产将在将拉取请求合并到 main 分支后托管在 GitHub Pages 上。

您可以通过单击检查的“详细信息”链接来检查新构建的内容。

a screenshot showing the list of GitHub checks running on CI

然后单击 Summary 查看构建产生的工件列表。

a screenshot showing how to click on the GitHub Actions summary page

检查网站的新版本#

下载工件并在本地解压。打开一个新的终端并运行以下命令以启动本地 Web 服务器:

python -m http.server

然后使用浏览器打开以下 URL:

https://:8000

您应该会看到您的 JupyterLite 网站的新版本。

a screenshot showing the new JupyterLab theme now available via the Settings menu

如果更改看起来不错,您可以合并拉取请求。GitHub Pages 网站将在几分钟后自动更新。