Skip to content

Build jupyter-book in repo2docker container and publish it #167

Build jupyter-book in repo2docker container and publish it

Build jupyter-book in repo2docker container and publish it #167

name: Build jupyter-book in repo2docker container and publish it
on:
push:
pull_request:
schedule:
- cron: '00 4 * * *' # daily at 4AM
jobs:
build:
# Pull requests are a duplicate of a branch push if they are from within the same repo. Skip these.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout files in repo
uses: actions/checkout@v3
- name: Set up Python 3.x.
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Cache multiple paths
uses: actions/cache@v2
with:
path: |
# This cache contains the notebook outputs
# See https://jupyterbook.org/content/execute.html#caching-the-notebook-execution
_build/.jupyter_cache
key: ${{ runner.os }}-jupyter_cache
- name: Install jupyter-repo2docker
run: |
set -vxeuo pipefail
python -m pip install -r binder/requirements-dev.txt
- name: Execute notebooks with Jupyter Book
run: |
set -vxeuo pipefail
# Use an editable installation so the _build/.jupyter_cache is
# mounted in the container and so that the build artifacts persist
# to the next step.
jupyter-repo2docker --editable . /bin/bash -c "jupyter-book build -W ."
- name: Deploy built book to blueskyproject.io
if: github.repository_owner == 'bluesky' && github.ref_name == 'main'
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: peaceiris/actions-gh-pages@64b46b4226a4a12da2239ba3ea5aa73e3163c75b # v3.9.1
with:
deploy_key: ${{ secrets.ACTIONS_DOCUMENTATION_DEPLOY_KEY }}
publish_branch: master
publish_dir: ./_build/html/
external_repository: bluesky/bluesky.github.io
destination_dir: tutorials
force_orphan: false # Keep git history.