Skip to content

Commit 6daefa1

Browse files
mmckyclaude
andauthored
Set up GitHub Pages publishing (#11)
* Set up GitHub Pages publishing (cache + publish workflows, environment) Mirrors the fa edition's publishing machinery, adapted for fr: - environment.yml copied from the English source (anaconda 2026.06, quantecon-book-theme 0.21.0) so the build matches the seeded content - cache.yml builds the execution cache on every push to main - publish.yml builds HTML on publish* tags, uploads a release archive, and deploys to gh-pages (custom-domain CNAME left commented pending the DNS decision); -W disabled for the first publishes, as in cache.yml - _config.yml now points at this repo and its actual serving URL (quantecon.github.io/lecture-python-programming.fr) instead of the English site, avoiding the baseurl/CNAME mismatch found on fa and zh-cn; also sets Sphinx language: fr Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Deploy Pages via the native artifact flow instead of a gh-pages branch Replaces peaceiris/actions-gh-pages with actions/upload-pages-artifact + actions/deploy-pages (both v5), matching the Pages source already enabled on this repo (build_type: workflow). No gh-pages branch and no post-publish settings flip needed; the custom domain, when decided, is set in Settings -> Pages together with the _config.yml baseurl. The github-pages environment's deployment policy has been extended with a publish* tag rule so tag-triggered deploys pass protection checks. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Simplify publish.yml: HTML only, via quantecon/actions/publish-gh-pages Follows the English source repo's publish workflow (the current fleet convention) rather than fa's older hand-rolled pattern: - deploy + release assets (archive, checksum, manifest) collapse into one quantecon/actions/publish-gh-pages@v0.8.0 step, which uses the native Pages artifact flow - commented PDF/notebook blocks and the LaTeX toolchain install removed (HTML only for now); GPU runner and JAX steps from the source repo are not needed here, as on fa - no cname: the site serves at the default Pages URL, https://quantecon.github.io/lecture-python-programming.fr/, and the custom-domain TODO comment is dropped from _config.yml Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Add Netlify PR previews (ci.yml) for reviewer-facing rendered builds Uses quantecon/actions/preview-netlify@v0.8.0 (the lecture-python.myst pattern), HTML only, on ubuntu-latest. The action posts a PR comment with the preview URL and the changed lectures, so translation review can happen on rendered French pages rather than MyST diffs. Requires two secrets not yet available to this repo: the org-level NETLIFY_AUTH_TOKEN extended to include this repo, and a repo-level NETLIFY_SITE_ID for a new Netlify site. Until they exist the preview step self-skips for untrusted actors but will fail for in-repo PRs, so grant them before merging or expect red previews. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Address Copilot review: drop dangling nb_repository_url, clear doctrees - nb_repository_url pointed at lecture-python-programming.fr.notebooks, which does not exist; the theme (launch.py) skips notebook-launch links entirely when the key is unset, so removing it is clean for an HTML-only edition - publish.yml now clears _build/.doctrees after downloading the cache (as ci.yml already did, following lecture-python.myst), removing the one staleness vector in the latest-from-main cache convention Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent e641d96 commit 6daefa1

5 files changed

Lines changed: 193 additions & 6 deletions

File tree

.github/workflows/cache.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Cache [using jupyter-book]
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
cache:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v6
11+
- name: Setup Anaconda
12+
uses: conda-incubator/setup-miniconda@v4
13+
with:
14+
auto-update-conda: true
15+
auto-activate-base: true
16+
miniconda-version: 'latest'
17+
python-version: "3.13"
18+
environment-file: environment.yml
19+
activate-environment: quantecon
20+
- name: Build HTML
21+
shell: bash -l {0}
22+
run: |
23+
jb build lectures --path-output ./ --keep-going
24+
# TODO: Re-enable -W flag once all lectures are translated and warnings are resolved
25+
- name: Upload Execution Reports
26+
uses: actions/upload-artifact@v7
27+
if: failure()
28+
with:
29+
name: execution-reports
30+
path: _build/html/reports
31+
- name: Upload "_build" folder (cache)
32+
uses: actions/upload-artifact@v7
33+
with:
34+
name: build-cache
35+
path: _build
36+
include-hidden-files: true

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Build Project [using jupyter-book]
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
jobs:
6+
preview:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
steps:
12+
- uses: actions/checkout@v7
13+
with:
14+
ref: ${{ github.event.pull_request.head.sha }}
15+
fetch-depth: 0
16+
- name: Setup Anaconda
17+
uses: conda-incubator/setup-miniconda@v4
18+
with:
19+
auto-update-conda: true
20+
auto-activate-base: true
21+
miniconda-version: 'latest'
22+
python-version: "3.13"
23+
environment-file: environment.yml
24+
activate-environment: quantecon
25+
- name: Display Conda Environment Versions
26+
shell: bash -l {0}
27+
run: conda list
28+
- name: Display Pip Versions
29+
shell: bash -l {0}
30+
run: pip list
31+
- name: Download "build" folder (cache)
32+
uses: dawidd6/action-download-artifact@v21
33+
with:
34+
workflow: cache.yml
35+
branch: main
36+
name: build-cache
37+
path: _build
38+
- name: Clear stale Sphinx environment
39+
shell: bash -l {0}
40+
run: rm -rf _build/.doctrees
41+
# HTML only for now — no PDF or notebook assets
42+
- name: Build HTML
43+
shell: bash -l {0}
44+
run: |
45+
jb build lectures --path-output ./ -n --keep-going
46+
# TODO: Re-enable -W flag once all lectures are translated and warnings are resolved
47+
- name: Upload Execution Reports
48+
uses: actions/upload-artifact@v7
49+
if: failure()
50+
with:
51+
name: execution-reports
52+
path: _build/html/reports
53+
- name: Setup Node.js
54+
uses: actions/setup-node@v6
55+
with:
56+
node-version: '20'
57+
- name: Preview Deploy to Netlify
58+
uses: quantecon/actions/preview-netlify@v0.8.0
59+
with:
60+
netlify-auth-token: ${{ secrets.NETLIFY_AUTH_TOKEN }}
61+
netlify-site-id: ${{ secrets.NETLIFY_SITE_ID }}
62+
build-dir: _build/html

.github/workflows/publish.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Build & Publish to GH Pages
2+
on:
3+
push:
4+
tags:
5+
- 'publish*'
6+
7+
permissions:
8+
contents: write
9+
actions: read
10+
pages: write
11+
id-token: write
12+
13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: false
16+
17+
jobs:
18+
publish:
19+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
20+
runs-on: ubuntu-latest
21+
environment:
22+
name: github-pages
23+
url: ${{ steps.deployment.outputs['page-url'] }}
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v7
27+
with:
28+
fetch-depth: 0
29+
- name: Setup Anaconda
30+
uses: conda-incubator/setup-miniconda@v4
31+
with:
32+
auto-update-conda: true
33+
auto-activate-base: true
34+
miniconda-version: 'latest'
35+
python-version: "3.13"
36+
environment-file: environment.yml
37+
activate-environment: quantecon
38+
- name: Display Conda Environment Versions
39+
shell: bash -l {0}
40+
run: conda list
41+
- name: Display Pip Versions
42+
shell: bash -l {0}
43+
run: pip list
44+
# Download Build Cache from cache.yml
45+
- name: Download "build" folder (cache)
46+
uses: dawidd6/action-download-artifact@v21
47+
with:
48+
workflow: cache.yml
49+
branch: main
50+
name: build-cache
51+
path: _build
52+
- name: Clear stale Sphinx environment
53+
shell: bash -l {0}
54+
run: rm -rf _build/.doctrees
55+
# HTML only for now — no PDF or notebook assets
56+
- name: Build HTML
57+
shell: bash -l {0}
58+
run: |
59+
jb build lectures --path-output ./ -n --keep-going
60+
# TODO: Re-enable -W flag once all lectures are translated and warnings are resolved
61+
# Serves at the default Pages URL (no cname):
62+
# https://quantecon.github.io/lecture-python-programming.fr/
63+
- name: Deploy to GitHub Pages
64+
id: deployment
65+
uses: quantecon/actions/publish-gh-pages@v0.8.0
66+
with:
67+
build-dir: _build/html
68+
create-release-assets: 'true'
69+
asset-name: 'lecture-python-programming-fr-html'
70+
github-token: ${{ secrets.GITHUB_TOKEN }}

environment.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: quantecon
2+
channels:
3+
- default
4+
dependencies:
5+
- python=3.13
6+
- anaconda=2026.06
7+
- pip
8+
- pip:
9+
- jupyter-book>=1.0.4post1,<2.0
10+
- quantecon-book-theme==0.21.0
11+
- sphinx-tojupyter==0.6.0
12+
- sphinxext-rediraffe==0.3.0
13+
- sphinx-exercise==1.2.1
14+
- sphinxcontrib-youtube==1.5.0
15+
- sphinx-togglebutton==0.4.5
16+
17+

lectures/_config.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ execute:
88
timeout: 600 # 10 minutes
99

1010
html:
11-
baseurl: https://python-programming.quantecon.org/
11+
baseurl: https://quantecon.github.io/lecture-python-programming.fr/
1212

1313
latex:
1414
latex_documents:
15-
targetname: quantecon-python-programming.tex
15+
targetname: quantecon-python-programming-fr.tex
1616

1717
sphinx:
1818
extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_tojupyter, sphinx_exercise, sphinx_togglebutton, sphinx.ext.intersphinx]
1919
config:
20+
language: fr
2021
# bibtex_reference_style: author_year #TODO: enable if bibtex bibliography is used in series
2122
# false-positive links
2223
linkcheck_ignore: ['https://github.com/matplotlib/matplotlib/blob/v3.6.2/lib/matplotlib/axes/_axes.py#L1417-L1669',
@@ -43,8 +44,9 @@ sphinx:
4344
dark_logo: quantecon-logo-transparent.png
4445
header_organisation_url: https://quantecon.org
4546
header_organisation: QuantEcon
46-
repository_url: https://github.com/QuantEcon/lecture-python-programming
47-
nb_repository_url: https://github.com/QuantEcon/lecture-python-programming.notebooks
47+
repository_url: https://github.com/QuantEcon/lecture-python-programming.fr
48+
# nb_repository_url omitted deliberately: no notebooks repo exists for this
49+
# edition yet, and the theme skips notebook-launch links when it is unset
4850
path_to_docs: lectures
4951
twitter: quantecon
5052
twitter_logo_url: https://assets.quantecon.org/img/qe-twitter-logo.png
@@ -67,8 +69,8 @@ sphinx:
6769
index_toc.md: intro.md
6870
tojupyter_static_file_path: ["source/_static", "_static"]
6971
tojupyter_target_html: true
70-
tojupyter_urlpath: "https://python-programming.quantecon.org/"
71-
tojupyter_image_urlpath: "https://python-programming.quantecon.org/_static/"
72+
tojupyter_urlpath: "https://quantecon.github.io/lecture-python-programming.fr/"
73+
tojupyter_image_urlpath: "https://quantecon.github.io/lecture-python-programming.fr/_static/"
7274
tojupyter_lang_synonyms: ["ipython", "ipython3", "python"]
7375
tojupyter_kernels:
7476
python3:

0 commit comments

Comments
 (0)