-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (37 loc) · 1.23 KB
/
notebook_to_html.yml
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
name: Convert Jupyter Notebook to HTML
on:
push:
paths:
- 'demo/particle_comets.ipynb'
jobs:
convert:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@main
with:
ref: main
fetch-depth: 0 # Fetch all history to have access to the gh-pages branch
- name: Set up Python
uses: actions/setup-python@main
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nbconvert
- name: Convert Jupyter Notebook to HTML
run: |
jupyter nbconvert --to html demo/particle_comets.ipynb
- name: Commit and push HTML to gh-pages branch
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git fetch origin
mv demo/particle_comets.html /tmp/particle_comets.html
git checkout gh-pages || git checkout -b gh-pages
git pull origin gh-pages
mv /tmp/particle_comets.html demo/particle_comets.html
git add demo/particle_comets.html
git diff-index --quiet HEAD || git commit -m "Update HTML file"
git push origin gh-pages || true