@@ -21,55 +21,55 @@ jobs:
2121 marimo :
2222 runs-on : ubuntu-latest
2323 steps :
24- # Set up the Python virtual environment with all required dependencies
25- # This uses a reusable action from the cradle repository
26- - name : " Build the virtual environment for ${{ github.repository }}"
27- uses :
tschm/cradle/actions/[email protected] 24+ # Check out the repository code
25+ - name : Checkout [${{ github.repository }}]
26+ uses : actions/checkout@v4
2827
29- # Find all Experiment*.py files in the book/marimo directory and export them to HTML
30- # This creates static HTML versions of the interactive notebooks
31- - name : " Export notebooks"
32- uses : tschm/cradle/actions/marimo@main
28+ - name : Install the latest version of uv and set the python version
29+ uses : astral-sh/setup-uv@v6
3330 with :
34- command : ' export html-wasm "$file" -o "artifacts/marimo/${filename}/index.html" --mode edit'
35- # run: |
36- # uv run pip install --no-cache-dir marimo
37- #
38- # # Find all Python files in book/marimo directory
39- # for notebook in book/marimo/Experiment*.py; do
40- # # Extract the filename without extension
41- # # echo "Detected notebook $notebook"
42- # filename=$(basename "$notebook" .py)
43- # echo "Detected filename $filename"
44- # # Create output
45- # folder=artifacts/notebooks/$filename
46- #
47- # mkdir -p $folder
48- # echo "Folder $folder"
49- # # Export as readonly, with code locked
50- # uv run marimo export html-wasm $notebook -o $folder/index.html
51- # echo "Exported $notebook to $folder"
52- # done
53- # ls -all artifacts/notebooks
54- #
55- # # Upload the generated HTML files as a GitHub Actions artifact
56- # # This makes the files available for the deployment job
57- # - name: Upload HTML artifacts
58- # uses: actions/upload-artifact@v4
59- # with:
60- # name: notebooks
61- # path: artifacts/notebooks
62- # retention-days: 1 # Keep artifacts for 1 day to save storage
31+ python-version : 3.13
32+
33+ # Convert all Marimo notebooks to HTML-WASM format
34+ # The WASM format allows for interactive elements to work in the browser
35+ - name : Convert notebooks to HTML-WASM
36+ run : |
37+ # uv run pip install --no-cache-dir marimo
38+ mkdir -p artifacts/marimo
39+
40+ # Find all Python files in the notebooks directory and export them to HTML-WASM
41+ for notebook in notebooks/*.py; do
42+ # Extract the filename without extension
43+ filename=$(basename "$notebook" .py)
44+ echo "Exporting $notebook to HTML-WASM..."
45+
46+ # Create output directory for this notebook
47+ mkdir -p artifacts/marimo/$filename
48+
49+ # Export in edit mode to allow users to modify the notebook
50+ uvx marimo export html-wasm $notebook -o artifacts/marimo/$filename/index.html --sandbox --mode edit
51+ done
52+
53+ # List all exported notebooks
54+ echo "Exported notebooks:"
55+ ls -la artifacts/marimo/
56+
57+ # Upload the generated HTML-WASM files as a GitHub Actions artifact
58+ # This makes the files available for the deployment job
59+ - name : Upload HTML artifacts
60+ # Note: This conditional is commented out but would skip upload when running locally with act
61+ uses : actions/upload-artifact@v4
62+ with :
63+ name : marimo
64+ path : artifacts/marimo
65+ retention-days : 1 # Keep artifacts for 1 day to save storage
6366
6467 # Job to build the Jupyter Book documentation
6568 # This converts Jupyter notebooks to a static website with navigation
6669 jupyter :
6770 runs-on : " ubuntu-latest"
6871 steps :
69- # Set up the Python virtual environment with all required dependencies
70- # This uses a reusable action from the cradle repository
71- - name : " Build the virtual environment for ${{ github.repository }}"
72- uses :
tschm/cradle/actions/[email protected] 72+
7373
7474 # Build the Jupyter Book using a reusable action
7575 # This action handles the book building process including configuration
0 commit comments