Skip to content

Commit b7c47b7

Browse files
authored
MAINT: Maintenance for GitHub Actions + enable download notebooks (#164)
* MAINT: Maintenance for GitHub Actions + enable download notebooks * fix typo * enable sphinx-tojupyter download notebook builds * enable publishing of download notebooks to notebook repo * enable gh-pages
1 parent d1281e3 commit b7c47b7

File tree

3 files changed

+53
-50
lines changed

3 files changed

+53
-50
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Build HTML [using jupyter-book]
2-
on: [push]
2+
on: [pull_request]
33
jobs:
4-
tests:
4+
preview:
55
runs-on: ubuntu-latest
66
steps:
77
- name: Checkout
@@ -51,12 +51,12 @@ jobs:
5151
# jb build lectures --builder pdflatex --path-output ./ -n --keep-going
5252
# mkdir -p _build/html/_pdf
5353
# cp -u _build/latex/*.pdf _build/html/_pdf
54-
# - name: Build Download Notebooks (sphinx-tojupyter)
55-
# shell: bash -l {0}
56-
# run: |
57-
# jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
58-
# mkdir -p _build/html/_notebooks
59-
# cp -u _build/jupyter/*.ipynb _build/html/_notebooks
54+
- name: Build Download Notebooks (sphinx-tojupyter)
55+
shell: bash -l {0}
56+
run: |
57+
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
58+
mkdir -p _build/html/_notebooks
59+
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
6060
# Build HTML (Website)
6161
# BUG: rm .doctress to remove `sphinx` rendering issues for ipywidget mimetypes
6262
# and clear the sphinx cache for building final HTML documents.

.github/workflows/publish.yml

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ jobs:
5555
# run: |
5656
# mkdir -p _build/html/_pdf
5757
# cp -u _build/latex/*.pdf _build/html/_pdf
58-
# - name: Build Download Notebooks (sphinx-tojupyter)
59-
# shell: bash -l {0}
60-
# run: |
61-
# jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
62-
# - name: Copy Download Notebooks for GH-PAGES
63-
# shell: bash -l {0}
64-
# run: |
65-
# mkdir -p _build/html/_notebooks
66-
# cp -u _build/jupyter/*.ipynb _build/html/_notebooks
58+
- name: Build Download Notebooks (sphinx-tojupyter)
59+
shell: bash -l {0}
60+
run: |
61+
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
62+
- name: Copy Download Notebooks for GH-PAGES
63+
shell: bash -l {0}
64+
run: |
65+
mkdir -p _build/html/_notebooks
66+
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
6767
# Build HTML (Website)
6868
# BUG: rm .doctress to remove `sphinx` rendering issues for ipywidget mimetypes
6969
# and clear the sphinx cache for building final HTML documents.
@@ -82,32 +82,33 @@ jobs:
8282
env:
8383
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
8484
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
85-
# - name: Deploy website to gh-pages
86-
# uses: peaceiris/actions-gh-pages@v3
87-
# with:
88-
# github_token: ${{ secrets.GITHUB_TOKEN }}
89-
# publish_dir: _build/html/
85+
- name: Deploy website to gh-pages
86+
uses: peaceiris/actions-gh-pages@v3
87+
with:
88+
github_token: ${{ secrets.GITHUB_TOKEN }}
89+
publish_dir: _build/html/
9090
# cname: intro.quantecon.org
9191
- name: Upload "_build" folder (cache)
9292
uses: actions/upload-artifact@v2
9393
with:
9494
name: build-publish
9595
path: _build
96-
# - name: Prepare lecture-python-intro.notebooks sync
97-
# shell: bash -l {0}
98-
# run: |
99-
# mkdir -p _build/lecture-python-intro.notebooks
100-
# cp -a _notebook_repo/. _build/lecture-python-intro.notebooks
101-
# cp _build/jupyter/*.ipynb _build/lecture-python-intro.notebooks
102-
# ls -a _build/lecture-python-intro.notebooks
103-
# - name: Commit latest notebooks to lecture-python-intro.notebooks
104-
# uses: cpina/github-action-push-to-another-repository@master
105-
# env:
106-
# API_TOKEN_GITHUB: ${{ secrets.QUANTECON_SERVICES_PAT }}
107-
# with:
108-
# source-directory: '_build/lecture-python-intro.notebooks/'
109-
# destination-repository-username: 'QuantEcon'
110-
# destination-repository-name: 'lecture-python-intro.notebooks'
111-
# commit-message: 'auto publishing updates to notebooks'
112-
# destination-github-username: 'quantecon-services'
113-
# user-email: [email protected]
96+
# Sync notebooks
97+
- name: Prepare lecture-python-intro.notebooks sync
98+
shell: bash -l {0}
99+
run: |
100+
mkdir -p _build/lecture-python-intro.notebooks
101+
cp -a _notebook_repo/. _build/lecture-python-intro.notebooks
102+
cp _build/jupyter/*.ipynb _build/lecture-python-intro.notebooks
103+
ls -a _build/lecture-python-intro.notebooks
104+
- name: Commit latest notebooks to lecture-python-intro.notebooks
105+
uses: cpina/github-action-push-to-another-repository@master
106+
env:
107+
API_TOKEN_GITHUB: ${{ secrets.QUANTECON_SERVICES_PAT }}
108+
with:
109+
source-directory: '_build/lecture-python-intro.notebooks/'
110+
destination-repository-username: 'QuantEcon'
111+
destination-repository-name: 'lecture-python-intro.notebooks'
112+
commit-message: 'auto publishing updates to notebooks'
113+
destination-github-username: 'quantecon-services'
114+
user-email: [email protected]

lectures/_config.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ parse:
1717
- substitution
1818
- tasklist
1919

20+
only_build_toc_files: true
2021
execute:
2122
execute_notebooks: "cache"
2223
timeout: 600 # 10 minutes
23-
# run_in_temp: true
24+
exclude_patterns:
25+
- '_static/*'
2426

2527
html:
2628
baseurl: https://intro.quantecon.org/
@@ -33,21 +35,21 @@ latex:
3335
targetname: quantecon-python-intro.tex
3436

3537
sphinx:
36-
extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_exercise, sphinx_togglebutton, sphinx_proof] # sphinx_tojupyter
38+
extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_exercise, sphinx_togglebutton, sphinx_proof, sphinx_tojupyter]
3739
config:
3840
html_favicon: _static/lectures-favicon.ico
3941
html_theme: quantecon_book_theme
4042
html_static_path: ['_static']
4143
html_theme_options:
42-
# header_organisation_url: https://quantecon.org
43-
# header_organisation: QuantEcon
44+
header_organisation_url: https://quantecon.org
45+
header_organisation: QuantEcon
4446
repository_url: https://github.com/QuantEcon/lecture-python-intro
45-
# nb_repository_url: https://github.com/QuantEcon/lecture-python-intro.notebooks
46-
# twitter: quantecon
47-
# twitter_logo_url: https://assets.quantecon.org/img/qe-twitter-logo.png
48-
# og_logo_url: https://assets.quantecon.org/img/qe-og-logo.png
49-
# description: This website presents a set of lectures on python programming for economics, designed and written by Thomas J. Sargent and John Stachurski.
50-
# keywords: Python, QuantEcon, Quantitative Economics, Economics, Sloan, Alfred P. Sloan Foundation, Tom J. Sargent, John Stachurski
47+
nb_repository_url: https://github.com/QuantEcon/lecture-python-intro.notebooks
48+
twitter: quantecon
49+
twitter_logo_url: https://assets.quantecon.org/img/qe-twitter-logo.png
50+
og_logo_url: https://assets.quantecon.org/img/qe-og-logo.png
51+
description: This website presents introductory lectures on computational economics, designed and written by Thomas J. Sargent and John Stachurski.
52+
keywords: Python, QuantEcon, Quantitative Economics, Economics, Sloan, Alfred P. Sloan Foundation, Tom J. Sargent, John Stachurski
5153
# analytics:
5254
# google_analytics_id: UA-54984338-9
5355
launch_buttons:

0 commit comments

Comments
 (0)