Skip to content

feat: Add script to build lock file with Docker #235

feat: Add script to build lock file with Docker

feat: Add script to build lock file with Docker #235

name: Deploy Jupyter Book
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-book:
runs-on: ubuntu-latest
container: atlasamglab/stats-base:root6.28.04
steps:
- uses: actions/checkout@v3
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --no-deps --require-hashes --requirement book/requirements.lock
- name: List installed Python packages
run: |
python -m pip list
- name: Set track_progress=False for notebooks
run: |
git config --global --add safe.directory /__w/pyhf-tutorial/pyhf-tutorial
git grep --name-only "track_progress=True" book | xargs sed --in-place 's/track_progress=True/track_progress=False/g'
- name: Build the book
run: |
jupyter-book build book/
- name: Upload jupyter book
uses: actions/upload-artifact@v3
with:
name: jupyterbook
path: 'book/_build/html/'
build-pyodide:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pyodide
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade \
"jupyterlite[lab]" \
"jupytext>=1.14.0"
- name: List installed Python packages
run: |
python -m pip list
- name: Convert .py to notebook
run: |
jupytext --to notebook lite/jupyterlite.py
cp lite/*.ipynb book/
- name: Build the Pyodide output
run: |
jupyter lite --help
jupyter lite init
jupyter lite build --contents=book
jupyter lite check
- name: Upload Pyodide build
uses: actions/upload-artifact@v3
with:
name: jupyterlite
path: _output/
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [build-book, build-pyodide]
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
steps:
- name: Setup Pages
uses: actions/configure-pages@v2
- uses: actions/download-artifact@v3
with:
name: jupyterbook
path: 'public'
- uses: actions/download-artifact@v3
with:
name: jupyterlite
path: 'public/live'
- name: Fix permissions
run: |
chmod -c -R +rX "public/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: 'public'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1