Publish Jupyter notebook to Github pages #2078
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: "Publish Jupyter notebook to Github pages" | |
on: | |
push: | |
branches: | |
- main | |
repository_dispatch: | |
types: [generate-ghpages] | |
workflow_dispatch: | |
workflow_run: | |
workflows: ["Merge pharmacies from AFMPS & OSM"] | |
types: | |
- completed | |
jobs: | |
generate_ghpages: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛎️ Checkout | |
uses: actions/checkout@v4 | |
- name: 🔨 Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: 🚧 Install dependencies | |
run: pip3 install -r requirements.txt | |
- name: 🤖 Build index.html | |
run: jupyter nbconvert --to html --TemplateExporter.exclude_input=True --no-prompt --execute pharmacies.ipynb --output index.html | |
- name: 🕊️ Move files | |
run: | | |
mkdir ./public | |
mv ./index.html ./public/ | |
- name: 📬 Deploy to Github Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public |