Skip to content

update README.md

update README.md #39

name: Quarto Publish
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
build-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Install Python dependencies
run: |
uv venv
source .venv/bin/activate
uv pip install -e .
uv pip install jupyter ipykernel jupyter-cache
# Verify installation
python -c "import forestly; print('Forestly installed successfully')"
- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2
with:
version: 1.5.57
- name: Configure Jupyter kernel
run: |
source .venv/bin/activate
python -m ipykernel install --user --name=python3
# List available kernels for debugging
jupyter kernelspec list
- name: Render Quarto documents
run: |
source .venv/bin/activate
# Set Python path for Quarto
export QUARTO_PYTHON=$(which python)
echo "Using Python: $QUARTO_PYTHON"
# Render all documents
cd docs
quarto render --execute
- name: Inject required libraries
run: |
cd docs/_site
# Check if site was generated
if [ ! -d "." ] || [ -z "$(ls -A .)" ]; then
echo "Error: _site directory is empty"
exit 1
fi
# Inject libraries into HTML files
for html_file in *.html; do
if [ -f "$html_file" ]; then
echo "Processing $html_file..."
awk '
BEGIN {scripts_inserted = 0}
{
if (/<script/ && !scripts_inserted) {
print "<!-- Essential libraries for forest plot sparklines -->"
print "<script src=\"https://unpkg.com/react@17/umd/react.production.min.js\"></script>"
print "<script src=\"https://unpkg.com/react-dom@17/umd/react-dom.production.min.js\"></script>"
print "<script src=\"https://cdn.plot.ly/plotly-2.18.2.min.js\"></script>"
print "<!-- End essential libraries -->"
scripts_inserted = 1
}
print $0
}' "$html_file" > "${html_file}.tmp"
mv "${html_file}.tmp" "$html_file"
fi
done
echo "Library injection completed"
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/_site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4