|
4 | 4 | preview:
|
5 | 5 | runs-on: ubuntu-latest
|
6 | 6 | steps:
|
| 7 | + steps: |
7 | 8 | - uses: actions/checkout@v4
|
8 |
| - - name: Setup Anaconda |
9 |
| - uses: conda-incubator/setup-miniconda@v3 |
| 9 | + |
| 10 | + - name: Setup GitHub Pages |
| 11 | + uses: actions/configure-pages@v3 |
| 12 | + |
| 13 | + - name: Cache Notebook Execution |
| 14 | + uses: actions/cache@v3 |
| 15 | + id: cache-execution |
10 | 16 | with:
|
11 |
| - auto-update-conda: true |
12 |
| - auto-activate-base: true |
13 |
| - miniconda-version: 'latest' |
14 |
| - python-version: "3.12" |
15 |
| - environment-file: environment.yml |
16 |
| - activate-environment: quantecon |
17 |
| - - name: Install latex dependencies |
18 |
| - run: | |
19 |
| - sudo apt-get -qq update |
20 |
| - sudo apt-get install -y \ |
21 |
| - texlive-latex-recommended \ |
22 |
| - texlive-latex-extra \ |
23 |
| - texlive-fonts-recommended \ |
24 |
| - texlive-fonts-extra \ |
25 |
| - texlive-xetex \ |
26 |
| - latexmk \ |
27 |
| - xindy \ |
28 |
| - dvipng \ |
29 |
| - cm-super |
30 |
| - - name: Display Conda Environment Versions |
31 |
| - shell: bash -l {0} |
32 |
| - run: conda list |
33 |
| - - name: Display Pip Versions |
34 |
| - shell: bash -l {0} |
35 |
| - run: pip list |
36 |
| - - name: Download "build" folder (cache) |
37 |
| - uses: dawidd6/action-download-artifact@v9 |
| 17 | + path: ./lectures/_build/execute |
| 18 | + key: ${{ runner.os }}-execute-cache-${{ hashFiles('lectures/**/*.md') }} |
| 19 | + |
| 20 | + - uses: actions/setup-node@v4 |
38 | 21 | with:
|
39 |
| - workflow: cache.yml |
40 |
| - branch: main |
41 |
| - name: build-cache |
42 |
| - path: _build |
43 |
| - # Build Assets (Download Notebooks and PDF via LaTeX) |
44 |
| - - name: Build Download Notebooks (sphinx-tojupyter) |
45 |
| - shell: bash -l {0} |
46 |
| - run: | |
47 |
| - jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going |
48 |
| - mkdir -p _build/html/_notebooks |
49 |
| - cp -u _build/jupyter/*.ipynb _build/html/_notebooks |
50 |
| - - name: Build PDF from LaTeX |
51 |
| - shell: bash -l {0} |
52 |
| - run: | |
53 |
| - jb build lectures --builder pdflatex --path-output ./ -n -W --keep-going |
54 |
| - mkdir _build/html/_pdf |
55 |
| - cp -u _build/latex/*.pdf _build/html/_pdf |
56 |
| - # Final Build of HTML |
| 22 | + node-version: 18.x |
| 23 | + |
| 24 | + - name: Install Python |
| 25 | + if: steps.cache-execution.outputs.cache-hit != 'true' |
| 26 | + uses: actions/setup-python@v5 |
| 27 | + with: |
| 28 | + python-version: '3.12' |
| 29 | + cache: 'pip' |
| 30 | + cache-dependency-path: 'myst_requirements.txt' |
| 31 | + |
| 32 | + - name: Install execution requirements |
| 33 | + if: steps.cache-execution.outputs.cache-hit != 'true' |
| 34 | + run: python -m pip install -r myst_requirements.txt |
| 35 | + |
| 36 | + - name: Install MyST Markdown CLI |
| 37 | + run: npm install -g mystmd |
| 38 | + |
57 | 39 | - name: Build HTML
|
58 |
| - shell: bash -l {0} |
59 |
| - run: | |
60 |
| - jb build lectures --path-output ./ -n -W --keep-going |
61 |
| - - name: Upload Execution Reports |
62 |
| - uses: actions/upload-artifact@v4 |
63 |
| - if: failure() |
| 40 | + working-directory: ./lectures |
| 41 | + run: myst build --html --execute |
| 42 | + |
| 43 | + - name: Upload build output |
| 44 | + uses: actions/upload-pages-artifact@v3 |
64 | 45 | with:
|
65 |
| - name: execution-reports |
66 |
| - path: _build/html/reports |
| 46 | + path: './lectures/_build/html' |
| 47 | + |
67 | 48 | - name: Preview Deploy to Netlify
|
68 | 49 | uses: nwtgck/actions-netlify@v3
|
69 | 50 | with:
|
70 |
| - publish-dir: '_build/html/' |
| 51 | + publish-dir: './lectures/_build/html' |
71 | 52 | production-branch: main
|
72 | 53 | github-token: ${{ secrets.GITHUB_TOKEN }}
|
73 | 54 | deploy-message: "Preview Deploy from GitHub Actions"
|
|
0 commit comments