1- name : Build & Publish to GH-PAGES
1+ name : Build & Publish to GH Pages
22on :
33 push :
44 tags :
55 - ' publish*'
66jobs :
7+ deploy-runner :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - uses : iterative/setup-cml@v1
11+ - uses : actions/checkout@v3
12+ with :
13+ ref : ${{ github.event.pull_request.head.sha }}
14+ - name : Deploy runner on EC2
15+ env :
16+ REPO_TOKEN : ${{ secrets.QUANTECON_SERVICES_PAT }}
17+ AWS_ACCESS_KEY_ID : ${{ secrets.AWS_ACCESS_KEY_ID }}
18+ AWS_SECRET_ACCESS_KEY : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
19+ run : |
20+ cml runner launch \
21+ --cloud=aws \
22+ --cloud-region=us-west-2 \
23+ --cloud-type=p3.2xlarge \
24+ --labels=cml-gpu \
25+ --cloud-hdd-size=40
726 publish :
827 if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
9- runs-on : ubuntu-latest
28+ needs : deploy-runner
29+ runs-on : [self-hosted, cml-gpu]
30+ container :
31+ image : docker://nvidia/cuda:11.2.1-devel-ubuntu20.04
32+ options : --gpus all
1033 steps :
1134 - name : Checkout
1235 uses : actions/checkout@v2
@@ -19,37 +42,44 @@ jobs:
1942 python-version : 3.9
2043 environment-file : environment.yml
2144 activate-environment : quantecon
22- - name : Install latex dependencies
45+ - name : Install Jax and Upgrade CUDA
46+ shell : bash -l {0}
47+ run : |
48+ pip install --upgrade "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html
49+ nvidia-smi
50+ - name : Install Supporting Packages
2351 run : |
24- sudo apt-get -qq update
25- sudo apt-get install -y \
52+ apt-get -qq update
53+ export DEBIAN_FRONTEND=noninteractive
54+ apt-get install -y tzdata
55+ apt-get install -y git
56+ apt-get install -y \
2657 texlive-latex-recommended \
2758 texlive-latex-extra \
2859 texlive-fonts-recommended \
2960 texlive-fonts-extra \
3061 texlive-xetex \
3162 latexmk \
32- xindy \
33- dvipng \
34- cm-super
63+ xindy
3564 - name : Display Conda Environment Versions
3665 shell : bash -l {0}
3766 run : conda list
3867 - name : Display Pip Versions
3968 shell : bash -l {0}
4069 run : pip list
70+ # Download Build Cache from cache.yml
4171 - name : Download "build" folder (cache)
4272 uses : dawidd6/action-download-artifact@v2
4373 with :
4474 workflow : cache.yml
4575 branch : main
4676 name : build-cache
4777 path : _build
48- # Build Assets (Download Notebooks and PDF via LaTeX)
78+ # Build Assets (Download Notebooks, PDF via LaTeX)
4979 - name : Build PDF from LaTeX
5080 shell : bash -l {0}
5181 run : |
52- jb build lectures --builder pdflatex --path-output ./ -n --keep-going
82+ jb build lectures --builder pdflatex --path-output ./ -n -W - -keep-going
5383 - name : Copy LaTeX PDF for GH-PAGES
5484 shell : bash -l {0}
5585 run : |
5888 - name : Build Download Notebooks (sphinx-tojupyter)
5989 shell : bash -l {0}
6090 run : |
61- jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
91+ jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going
6292 zip -r download-notebooks.zip _build/jupyter
6393 - uses : actions/upload-artifact@v2
6494 with :
@@ -69,11 +99,11 @@ jobs:
6999 run : |
70100 mkdir -p _build/html/_notebooks
71101 cp -u _build/jupyter/*.ipynb _build/html/_notebooks
72- # Build HTML (Website )
102+ # Final Build of HTML (with assets )
73103 - name : Build HTML
74104 shell : bash -l {0}
75105 run : |
76- jb build lectures --path-output ./
106+ jb build lectures --path-output ./ -n -W --keep-going
77107 - name : Deploy website to gh-pages
78108 uses : peaceiris/actions-gh-pages@v3
79109 with :
@@ -87,14 +117,18 @@ jobs:
87117 cp -a _notebook_repo/. _build/lecture-python.notebooks
88118 cp _build/jupyter/*.ipynb _build/lecture-python.notebooks
89119 ls -a _build/lecture-python.notebooks
90- - name : Commit latest notebooks to lecture-python.notebooks
91- uses : cpina/github-action-push-to-another-repository@v1.3
120+ - name : Commit notebooks to lecture-python.notebooks
121+ shell : bash -l {0}
92122 env :
93- API_TOKEN_GITHUB : ${{ secrets.QUANTECON_SERVICES_PAT }}
94- with :
95- source-directory : ' _build/lecture-python.notebooks/'
96- destination-repository-username : ' QuantEcon'
97- destination-repository-name : ' lecture-python.notebooks'
98- commit-message : ' auto publishing updates to notebooks'
99- destination-github-username : ' quantecon-services'
100- user-email : services@quantecon.org
123+ QE_SERVICES_PAT : ${{ secrets.QUANTECON_SERVICES_PAT }}
124+ run : |
125+ git clone https://quantecon-services:$QE_SERVICES_PAT@github.com/quantecon/lecture-python.notebooks
126+
127+ cp _build/lecture-python.notebooks/*.ipynb lecture-python.notebooks
128+
129+ cd lecture-python.notebooks
130+ git config user.name "QuantEcon Services"
131+ git config user.email "admin@quantecon.org"
132+ git add *.ipynb
133+ git commit -m "auto publishing updates to notebooks"
134+ git push origin master
0 commit comments