Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
code

GitHub Action

repo2jupyterlite-action

v0.2 Pre-release

repo2jupyterlite-action

code

repo2jupyterlite-action

Publish a JupyterLite static site (with pre-installed packages) to GitHub pages.

Installation

Copy and paste the following snippet into your .yml file.

              

- name: repo2jupyterlite-action

uses: yuvipanda/repo2jupyterlite-action@v0.2

Learn more about this action in yuvipanda/repo2jupyterlite-action

Choose a version

repo2jupyterlite GitHub Action

Setting up publishing with GitHub Actions

  1. Enable publishing to GitHub Pages with GitHub Actions for your repository.
  2. Create a .github/workflows/publish.yaml file in your GitHub repository with the following contents.
name: Build and Publish jupyterlite page to GitHub Pages

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - '*'

jobs:
  build:
    runs-on: ubuntu-latest
    defaults:
      run:
        shell: bash -l {0}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Build repo2jupyterlite
        uses: yuvipanda/repo2jupyterlite-action@main
      - name: Upload generated site
        uses: actions/upload-pages-artifact@v1
        with:
          path: ./dist

  publish:
    needs: build
    if: github.ref == 'refs/heads/main'
    permissions:
      pages: write
      id-token: write

    environment:
      name: github-pages
      url: ${{ steps.publish.outputs.page_url }}

    runs-on: ubuntu-latest
    steps:
      - name: Publish to GitHub Pages
        id: publish
        uses: actions/deploy-pages@v1
  1. After you commit this workflow, go to the Actions tab in your repo and watch to see if the build and publish succeeded. If it did succeed, the URL to your published JupyterLite instance would be shown next to the Publish step. Usually this is of the form https://<your-github-username>.github.io/<repo-name>.

Install additional packages

repo2jupyterlite supports using mamba with emscriptenforge to install additional packages that are immediately available to your users when they start the JupyterLite instance. Not all packages are available, but the following are:

  1. All packages in conda-forge that have no C or compiled dependencies (aka noarch). This is the majority of packages!
  2. Special packages with emscriptenforge recipes

Eventually we will support traditional environment.yml files, but for now, you have to create a jupyter_lite_config.json file. Add the following contents to it:

{
    "XeusPythonEnv": {
        "packages": [
            "package-1",
            "package-2==<some-version>"
        ]
    }
}

If you commit the jupyter_lite_config.json file to your repo, the action will automatically use mamba to install these packages and make them available to the statically built output site. Note that you must select the XPython kernel, not the Pyodide kernel to have access to these extra packages.