Merge pull request #1 from shawndeggans/feature/setup #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate Docs | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'notebooks/**' | |
jobs: | |
convert-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Convert notebooks to markdown | |
run: | | |
for notebook in notebooks/*.ipynb; do | |
jupyter nbconvert --to markdown "$notebook" --output-dir docs/ | |
done | |
- name: Update index page | |
run: | | |
echo "## Available Documentation:" >> docs/index.md | |
echo "" >> docs/index.md | |
for file in docs/*.md; do | |
if [ "$(basename "$file")" != "index.md" ]; then | |
echo "- [$(basename "$file" .md)]($(basename "$file"))" >> docs/index.md | |
fi | |
done | |
- name: Commit and push changes | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add docs | |
git commit -m "Update documentation" || echo "No changes to commit" | |
git push |