-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (88 loc) · 3.16 KB
/
quarto-publish.yml
File metadata and controls
108 lines (88 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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