Skip to content

Commit 4072f10

Browse files
authored
Create publish.yml
1 parent 68bb350 commit 4072f10

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

.github/workflows/publish.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build & Publish to GH pages
2+
on:
3+
push:
4+
tags:
5+
- 'publish*'
6+
jobs:
7+
publish:
8+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
- name: Set up Python
14+
uses: actions/setup-python@v2
15+
with:
16+
python-version: 3.8
17+
- name: Install Python Dependencies
18+
run: |
19+
pip install -r requirements.txt
20+
- name: Install LaTeX dependencies
21+
run: |
22+
sudo apt-get -qq update
23+
sudo apt-get install -y \
24+
texlive-latex-recommended \
25+
texlive-latex-extra \
26+
texlive-fonts-recommended \
27+
texlive-fonts-extra \
28+
texlive-xetex \
29+
latexmk \
30+
xindy
31+
- name: Set up Julia
32+
uses: julia-actions/setup-julia@v1
33+
with:
34+
version: 1.6.0
35+
- run: julia -e 'using Pkg; Pkg.activate("lectures"); Pkg.instantiate(); Pkg.add("IJulia");'
36+
shell: bash
37+
- name: Build Download Notebooks (sphinx-tojupyter)
38+
shell: bash -l {0}
39+
run: |
40+
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
41+
zip -r download-notebooks.zip _build/jupyter
42+
- uses: actions/upload-artifact@v2
43+
with:
44+
name: download-notebooks
45+
path: download-notebooks.zip
46+
- name: Copy Download Notebooks for GH-PAGES
47+
shell: bash -l {0}
48+
run: |
49+
mkdir -p _build/html/_notebooks
50+
rsync -r _build/jupyter/ _build/html/_notebooks/
51+
52+
# Build Website
53+
- name: Build HTML
54+
shell: bash -l {0}
55+
run: |
56+
jb build lectures --path-output ./ -W --keep-going
57+
- name: Upload Execution Reports
58+
uses: actions/upload-artifact@v2
59+
if: failure()
60+
with:
61+
name: execution-reports
62+
path: _build/html/reports
63+
- name: Deploy website to gh-pages
64+
uses: peaceiris/actions-gh-pages@v3
65+
with:
66+
github_token: ${{ secrets.GITHUB_TOKEN }}
67+
publish_dir: _build/html/
68+
cname: datascience.quantecon.org
69+
- name: Upload "_build" folder (cache)
70+
uses: actions/upload-artifact@v2
71+
with:
72+
name: build-publish
73+
path: _build

0 commit comments

Comments
 (0)