Skip to content

Commit f7a488c

Browse files
edit marimo workflow
1 parent 73b4ecd commit f7a488c

File tree

1 file changed

+7
-44
lines changed

1 file changed

+7
-44
lines changed

.github/workflows/publish-marimo.yml

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches: [ main, master ]
66
paths:
7-
- '**/*.py' # Trigger on Python file changes
7+
- 'data_science_tools/polars_vs_pandas.py' # Only trigger on changes to this specific file
88
workflow_dispatch: # Allow manual triggering
99

1010
jobs:
@@ -27,52 +27,15 @@ jobs:
2727
# Install any other dependencies needed by your notebooks
2828
pip install pandas numpy polars
2929
30-
- name: Find and export marimo notebooks
30+
- name: Export marimo notebook
3131
run: |
32-
mkdir -p _site
32+
mkdir -p _site/data_science_tools
3333
34-
# Find all marimo notebooks (Python files with marimo imports)
35-
MARIMO_FILES=$(grep -l "import marimo" $(find . -name "*.py" ! -path "./venv/*" ! -path "./.github/*") || echo "")
34+
# Export the specific notebook to HTML
35+
marimo export "data_science_tools/polars_vs_pandas.py" --format html --output "_site/data_science_tools/polars_vs_pandas.html"
3636
37-
if [ -z "$MARIMO_FILES" ]; then
38-
echo "No marimo notebooks found."
39-
exit 0
40-
fi
41-
42-
# Export each notebook to HTML
43-
for file in $MARIMO_FILES; do
44-
echo "Processing $file"
45-
# Extract directory and filename
46-
filename=$(basename "$file" .py)
47-
directory=$(dirname "$file")
48-
output_dir="_site/${directory#./}"
49-
50-
# Create output directory
51-
mkdir -p "$output_dir"
52-
53-
# Export to HTML
54-
marimo export "$file" --format html --output "$output_dir/$filename.html"
55-
56-
# If this is in the root directory, create a copy for easy access
57-
if [ "$directory" = "." ]; then
58-
cp "$output_dir/$filename.html" "_site/$filename.html"
59-
fi
60-
done
61-
62-
# Create an index.html that lists all exported notebooks
63-
echo "<html><head><title>Marimo Notebooks</title><style>body{font-family:sans-serif;max-width:800px;margin:0 auto;padding:20px}h1{color:#0066cc}ul{list-style-type:none;padding:0}li{margin:10px 0;padding:10px;border:1px solid #eee;border-radius:5px}a{color:#0066cc;text-decoration:none}a:hover{text-decoration:underline}</style></head><body><h1>Marimo Notebooks</h1><ul>" > _site/index.html
64-
65-
find _site -name "*.html" ! -name "index.html" | sort | while read notebook; do
66-
rel_path="${notebook#_site/}"
67-
name=$(basename "$notebook" .html)
68-
dir=$(dirname "$rel_path")
69-
if [ "$dir" = "." ]; then
70-
dir="Root"
71-
fi
72-
echo "<li><strong>$dir/</strong> <a href=\"$rel_path\">$name</a></li>" >> _site/index.html
73-
done
74-
75-
echo "</ul></body></html>" >> _site/index.html
37+
# Create a simple index.html
38+
echo "<html><head><title>Marimo Notebooks</title><style>body{font-family:sans-serif;max-width:800px;margin:0 auto;padding:20px}h1{color:#0066cc}</style></head><body><h1>Marimo Notebooks</h1><p><a href=\"data_science_tools/polars_vs_pandas.html\">Polars vs Pandas</a></p></body></html>" > _site/index.html
7639
7740
- name: Deploy to GitHub Pages
7841
uses: JamesIves/github-pages-deploy-action@v4

0 commit comments

Comments
 (0)