This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Jupyterlite and push it to build branch | |
on: | |
push: | |
paths: | |
- jupyterlite/**/* | |
- src/content/_jupyter/**/* | |
- tailwind.config.js | |
pull_request: | |
types: [closed] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Build and push Jupyterlite | |
env: | |
BUILD_BRANCH: jupyterlite | |
BUILD_DIRECTORY: jupyterlite | |
BUILD_OUTPUT_DIRECTORY: public | |
steps: | |
- name: git-checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Build Jupyterlite with custom extensions | |
env: | |
PATCHES_DIRECTORY: patches | |
TARGET_DIRECTORY: ${{ env.BUILD_OUTPUT_DIRECTORY }} | |
working-directory: ${{ env.BUILD_DIRECTORY }} | |
run: | | |
## Install dependencies for Jupyterlite and Jupyterlab | |
python -m pip install -r requirements.txt | |
## Copy content (notebooks, images, etc.) | |
mkdir ./files | |
cp -r ../src/content/_jupyter/* ./files | |
## Install extensions | |
cd extensions/ | |
for EXTENSION in $(ls -d */); do | |
cd $EXTENSION | |
jlpm cache clean | |
pip install -v . | |
jlpm run build | |
cd ../ | |
done | |
jupyter labextension list | |
## Build Jupyterlite | |
cd ../ | |
jupyter lite build --output-dir ${{ env.BUILD_OUTPUT_DIRECTORY }} | |
## Patch the build | |
python patch.py | |
- name: Push | |
uses: s0/git-publish-subdir-action@develop | |
env: | |
REPO: self | |
BRANCH: ${{ env.BUILD_BRANCH }} | |
FOLDER: ${{ env.BUILD_DIRECTORY }}/${{ env.BUILD_OUTPUT_DIRECTORY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MESSAGE: "Build: ({sha}) {msg}" | |
TARGET_DIR: public |