-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (55 loc) · 2.34 KB
/
autodoc_tutorials.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: autogenerate docs from tutorials
on:
# Triggers the workflow on push but only for the main branch
push:
branches: [ auto-doc-generation ]
paths: ['**.ipynb']
jobs:
docs-from-tutorials:
runs-on: ubuntu-latest
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 512
swap-size-mb: 1024
remove-dotnet: 'true'
remove-codeql: 'true'
remove-android: 'true'
remove-docker-images: 'true'
# Check out repo and set up Python
- name: Check out the repository
uses: actions/checkout@v4
with:
lfs: true
# Use cached python and dependencies, install poetry
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: 3.8
poetry-version: 1.2.2
- name: Install jupyter
run: poetry install -E notebook
- name: Install pandoc
run: |
sudo wget https://github.com/jgm/pandoc/releases/download/3.1.8/pandoc-3.1.8-1-amd64.deb
sudo dpkg -i pandoc-3.1.8-1-amd64.deb
# Remove whitespaces in filenames of tutorial notebooks only during workflow
- name: remove whitespaces in tutorial filenames
run: |
find $GITHUB_WORKSPACE/tutorial -type f -exec bash -c 'newname="${1// /}"; newname="${newname//-/_}"; mv "$1" "$newname"' bash {} \;
# Execute and convert notebooks
- name: execute notebooks
run: |
find $GITHUB_WORKSPACE/tutorial -type f -name "*.ipynb" -exec poetry run jupyter-nbconvert --execute --to notebook --inplace {} \;
- name: create docs/tutorial directory
run: mkdir -p $GITHUB_WORKSPACE/docs/tutorial
- name: convert notebooks to rst and save to docs
run: find $GITHUB_WORKSPACE/tutorial -type f -name "*.ipynb" -exec poetry run jupyter-nbconvert --to rst --output-dir $GITHUB_WORKSPACE/docs/tutorial {} \;
# find tutorial -type f -name "*.ipynb" -exec poetry run jupyter-nbconvert --to rst --output-dir docs/tutorial {} \;
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'Updating tutorial rsts for docs'
add: 'docs/tutorial/'