Skip to content

Fix lack of kernel in JupyterLite #44

Fix lack of kernel in JupyterLite

Fix lack of kernel in JupyterLite #44

Workflow file for this run

name: Build and deploy site
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
name: Build site with Jekyll and JupyterLite
steps:
# Check out from Git
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
# Set up and use cache for Python dependencies
- name: Python dependencies cache
id: python-dependencies-cache
uses: actions/cache@v4
with:
# cache downloaded and installed packages
path: |
~/.cache/pip
~/.local/lib/python3.11/site-packages
~/.local/bin
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
# Install Jupyter and any other Python packages defined in requirements.txt
# --user flag is necessary to be able to cache packages installed by pip,
# but not standard library Python packages
- name: Install Python dependencies
working-directory: jupyterlite
run: |
python -m pip install --user --upgrade pip
python -m pip install --user -r requirements.txt
# Set up and use cache for Jekyll page generation
- name: Jekyll rendered pages cache
id: jekyll-build-cache
uses: actions/cache@v4
with:
# cache generated pages and assets
path: |
_site
key: jekyll-${{ hashFiles('public/**') }}
restore-keys: |
jekyll-
# Build the main part of the site using Jekyll Docker image
- name: Build the main site with Jekyll
if: steps.jekyll-build-cache.outputs.cache-hit != 'true'
working-directory: public
run: |
docker run \
-v ${{ github.workspace }}/public:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \
-e PAGES_REPO_NWO=$GITHUB_REPOSITORY -e JEKYLL_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
jekyll/builder:pages /bin/bash -c \
"chmod -R 777 /srv/jekyll && jekyll build --incremental --future"
# Build the lab part of the site using JupyterLite
# the sed command replaces faulty code in JupyterLite that prevents using
# it when installed in the user's home space
# see https://github.com/jupyterlite/jupyterlite/discussions/1136
- name: Build the lab site with JupyterLite
working-directory: jupyterlite
run: |
mkdir -p ../_site/notebooks/
sed -i -e 's/ENV_EXTENSIONS = Path(sys.prefix) / SHARE_LABEXTENSIONS/ENV_EXTENSIONS = Path('/home/ubuntu/.local/share/jupyter/labextensions/')/g' ~/.local/lib/python3.11/site-packages/jupyterlite_core/addons/federated_extensions.py
jupyter lite build --contents notebooks --output-dir ../_site/notebooks
# Ready and upload artifact for deployment
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action