diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml index cbc3236..ec8c268 100644 --- a/.github/workflows/book.yml +++ b/.github/workflows/book.yml @@ -70,3 +70,22 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./docs/_build/html + + - name: Generate tutorial notebooks + run: | + pixi run python -m jupytext docs/tutorial/intro.md --to ipynb -o docs/notebook/01-intro.ipynb + pixi run python -m jupytext docs/tutorial/data.md --to ipynb -o docs/notebook/02-data.ipynb + pixi run python -m jupytext docs/tutorial/models.md --to ipynb -o docs/notebook/03-models.ipynb + pixi run python -m jupytext docs/tutorial/registration.md --to ipynb -o docs/notebook/04-registration.ipynb + pixi run python -m jupytext docs/tutorial/solution.md --to ipynb -o docs/notebook/05-solution.ipynb + + - name: Commit updated notebooks + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + run: | + if [[ -n "$(git status --porcelain docs/notebook/*.ipynb)" ]]; then + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add docs/notebook/*.ipynb + git commit -m "Update tutorial notebooks" + git push + fi