Skip to content

overhaul

overhaul #6

name: Convert and Publish Notebooks
on:
push:
branches:
- master
jobs:
convert-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.12'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo 'export PATH="$HOME/.local/bin:$PATH"' >> $GITHUB_ENV
export PATH="$HOME/.local/bin:$PATH"
- name: Install Dependencies
run: |
poetry install
- name: Convert Notebooks to QMD
run: |
mkdir -p qmd
for notebook in $(find . -name "*.ipynb"); do
poetry run jupyter nbconvert --to markdown --output-dir=qmd "$notebook"
done
- name: Create Index File
run: |
echo "# Index" > qmd/index.qmd
for file in $(ls qmd/*.md); do
title=$(basename "$file" .md)
echo "- [$title](./$title.html)" >> qmd/index.qmd
done
- name: Render QMD Files
run: |
mkdir -p rendered
for qmd in $(find qmd -name "*.qmd"); do
poetry run quarto render "$qmd" --to html --output-dir rendered
done
- name: Move rendered files to docs
run: |
rm -rf ./docs
mv ./rendered ./docs
echo "" > ./docs/.nojekyll
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main