adding jupyterlite deployment #1
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: Deploy Jupyter Notebooks to GitHub Pages | |
| on: | |
| push: | |
| branches: [ main, dev ] | |
| env: | |
| TEMPLATE_REPO: 'DurhamARC-Training/PythonCourse-jupyterlite' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout template repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ env.TEMPLATE_REPO }} | |
| - name: Checkout main repository into content directory | |
| uses: actions/checkout@v4 | |
| with: | |
| path: content | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install template dependencies | |
| run: | | |
| python -m pip install -r requirements.txt | |
| - name: Install content dependencies | |
| run: | | |
| if [ -f content/requirements.txt ]; then | |
| echo "Found content/requirements.txt, installing dependencies..." | |
| python -m pip install -r content/requirements.txt | |
| else | |
| echo "No content/requirements.txt found, skipping content dependencies" | |
| fi | |
| - name: Build the JupyterLite site | |
| run: | | |
| cp README.md content | |
| jupyter lite build --contents content --output-dir dist | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./dist | |
| deploy: | |
| needs: build | |
| if: github.ref == 'refs/heads/main' | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |