Build docs #58
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
# This builds and deploys ISLP docs | |
name: Build docs | |
# Controls when the workflow will run | |
on: | |
workflow_dispatch: | |
inputs: null | |
# A workflow run is made up of one or more jobs that can run | |
# sequentially or in parallel | |
jobs: # This workflow contains a single | |
# job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
node-version: 20.x | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
# Install | |
- name: Install dependencies | |
run: | | |
sudo apt-get install r-base | |
pip install -r docs/requirements.txt | |
pip install . | |
# Checkout labs | |
- name: Checkout version of labs | |
run: | | |
git submodule update --init --force docs/ISLP_labs | |
cd docs | |
mkdir -p source/labs | |
cp ISLP_labs/Ch*nb source/labs | |
python fix_and_clear_notebooks.py source/labs/Ch*nb --rm_md | |
python make_notebooks.py --inplace --requirements=ISLP_labs/requirements.txt source/labs/Ch06-varselect-lab.ipynb | |
rm source/labs/Ch*md | |
- name: Make docs | |
run: | | |
cd docs | |
make html | |
# Store the output | |
- name: Upload docs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ISLP_docs | |
path: docs/build/html | |
retention-days: 5 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
environment: | |
name: github-pages | |
url: ${{steps.deployment.outputs.page_url}} | |
steps: | |
- uses: actions/download-artifact@master | |
with: | |
name: ISLP_docs | |
path: . | |
- uses: actions/configure-pages@v4 | |
with: | |
node-version: 20.x | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
node-version: 20.x | |
path: . | |
- id: deployment | |
uses: actions/deploy-pages@main |