|
6 | 6 | steps: |
7 | 7 | - name: Checkout |
8 | 8 | uses: actions/checkout@v5 |
9 | | - - name: Setup Anaconda |
10 | | - uses: conda-incubator/setup-miniconda@v3 |
| 9 | + |
| 10 | + # NEW: Use composite action for environment setup |
| 11 | + - name: Setup Lecture Environment |
| 12 | + uses: quantecon/actions/setup-lecture-env@main |
11 | 13 | with: |
12 | | - auto-update-conda: true |
13 | | - auto-activate-base: true |
14 | | - miniconda-version: 'latest' |
15 | | - python-version: "3.13" |
16 | | - environment-file: environment.yml |
17 | | - activate-environment: quantecon |
| 14 | + python-version: '3.13' |
| 15 | + environment-file: 'environment.yml' |
| 16 | + |
18 | 17 | - name: Graphics Support #TODO: Review if graphviz is needed |
19 | 18 | run: | |
20 | 19 | sudo apt-get -qq update && sudo apt-get install -y graphviz |
21 | | - - name: Install latex dependencies |
22 | | - run: | |
23 | | - sudo apt-get -qq update |
24 | | - sudo apt-get install -y \ |
25 | | - texlive-latex-recommended \ |
26 | | - texlive-latex-extra \ |
27 | | - texlive-fonts-recommended \ |
28 | | - texlive-fonts-extra \ |
29 | | - texlive-xetex \ |
30 | | - latexmk \ |
31 | | - xindy \ |
32 | | - dvipng \ |
33 | | - cm-super |
| 20 | + |
| 21 | + # NEW: Use composite action for LaTeX setup |
| 22 | + - name: Install LaTeX Dependencies |
| 23 | + uses: quantecon/actions/setup-latex@main |
| 24 | + |
34 | 25 | - name: Display Conda Environment Versions |
35 | 26 | shell: bash -l {0} |
36 | 27 | run: conda list |
| 28 | + |
37 | 29 | - name: Display Pip Versions |
38 | 30 | shell: bash -l {0} |
39 | 31 | run: pip list |
| 32 | + |
40 | 33 | - name: Download "build" folder (cache) |
41 | 34 | uses: dawidd6/action-download-artifact@v11 |
42 | 35 | with: |
43 | 36 | workflow: cache.yml |
44 | 37 | branch: main |
45 | 38 | name: build-cache |
46 | 39 | path: _build |
| 40 | + |
47 | 41 | # Build Assets (Download Notebooks and PDF via LaTeX) |
| 42 | + # NEW: Use composite action for PDF build |
48 | 43 | - name: Build PDF from LaTeX |
| 44 | + id: build-pdf |
| 45 | + uses: quantecon/actions/build-lectures@main |
| 46 | + with: |
| 47 | + builder: 'pdflatex' |
| 48 | + source-dir: 'lectures' |
| 49 | + extra-args: '-n --keep-going' |
| 50 | + |
| 51 | + - name: Copy LaTeX PDF for GH-PAGES |
49 | 52 | shell: bash -l {0} |
50 | 53 | run: | |
51 | | - jb build lectures --builder pdflatex --path-output ./ -n --keep-going |
52 | 54 | mkdir -p _build/html/_pdf |
53 | 55 | cp -u _build/latex/*.pdf _build/html/_pdf |
| 56 | + |
54 | 57 | - name: Upload Execution Reports (LaTeX) |
55 | 58 | uses: actions/upload-artifact@v5 |
56 | 59 | if: failure() |
57 | 60 | with: |
58 | | - name: execution-reports |
| 61 | + name: execution-reports-latex |
59 | 62 | path: _build/latex/reports |
| 63 | + |
| 64 | + # NEW: Use composite action for Jupyter build |
60 | 65 | - name: Build Download Notebooks (sphinx-tojupyter) |
| 66 | + id: build-jupyter |
| 67 | + uses: quantecon/actions/build-lectures@main |
| 68 | + with: |
| 69 | + builder: 'jupyter' |
| 70 | + source-dir: 'lectures' |
| 71 | + extra-args: '' |
| 72 | + |
| 73 | + - name: Copy Download Notebooks for GH-PAGES |
61 | 74 | shell: bash -l {0} |
62 | 75 | run: | |
63 | | - jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter |
64 | 76 | mkdir -p _build/html/_notebooks |
65 | 77 | cp -u _build/jupyter/*.ipynb _build/html/_notebooks |
| 78 | + |
66 | 79 | # Build HTML (Website) |
67 | 80 | # BUG: rm .doctress to remove `sphinx` rendering issues for ipywidget mimetypes |
68 | 81 | # and clear the sphinx cache for building final HTML documents. |
| 82 | + - name: Remove doctrees cache |
| 83 | + run: rm -r _build/.doctrees |
| 84 | + |
| 85 | + # NEW: Use composite action for HTML build |
69 | 86 | - name: Build HTML |
70 | | - shell: bash -l {0} |
71 | | - run: | |
72 | | - rm -r _build/.doctrees |
73 | | - jb build lectures --path-output ./ -nW --keep-going |
| 87 | + id: build-html |
| 88 | + uses: quantecon/actions/build-lectures@main |
| 89 | + with: |
| 90 | + builder: 'html' |
| 91 | + source-dir: 'lectures' |
| 92 | + extra-args: '-nW --keep-going' |
| 93 | + |
74 | 94 | - name: Upload Execution Reports (HTML) |
75 | 95 | uses: actions/upload-artifact@v5 |
76 | 96 | if: failure() |
77 | 97 | with: |
78 | | - name: execution-reports |
| 98 | + name: execution-reports-html |
79 | 99 | path: _build/html/reports |
| 100 | + |
| 101 | + # NEW: Use composite action for Netlify deployment |
80 | 102 | - name: Preview Deploy to Netlify |
81 | | - uses: nwtgck/actions-netlify@v3.0 |
| 103 | + uses: quantecon/actions/deploy-netlify@main |
82 | 104 | with: |
83 | | - publish-dir: '_build/html/' |
84 | | - production-branch: main |
| 105 | + netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 106 | + netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }} |
| 107 | + build-dir: ${{ steps.build-html.outputs.build-path }} |
| 108 | + production: 'false' |
85 | 109 | github-token: ${{ secrets.GITHUB_TOKEN }} |
86 | | - deploy-message: "Preview Deploy from GitHub Actions" |
87 | | - env: |
88 | | - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
89 | | - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
|
0 commit comments