Commit all changes in the codebase #2
This file contains hidden or 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: Convert Jupyter Notebook to HTML and Deploy to GitHub Pages | |
| on: | |
| push: | |
| paths: | |
| - '**.ipynb' | |
| jobs: | |
| convert: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Cache pip | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade pip | |
| pip install notebook==7.0.6 pandas matplotlib numpy plotly scikit-learn | |
| - name: Clean output directory | |
| run: rm -rf converted_html && mkdir -p converted_html | |
| - name: Convert all notebooks to HTML | |
| run: | | |
| set -e | |
| for notebook in $(find . -name "*.ipynb"); do | |
| jupyter nbconvert --to html "$notebook" --output-dir=converted_html | |
| done | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./converted_html | |
| force_orphan: true |