Skip to content

Commit 191b98c

Browse files
committed
Attempting to switch to a github action to render the website.
1 parent 7ad4cc4 commit 191b98c

File tree

2 files changed

+53
-24
lines changed

2 files changed

+53
-24
lines changed

.github/workflows/deploy.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This file was created automatically with `jupyter-book init --gh-pages` 🪄 💚
2+
# Ensure your GitHub Pages settings for this repository are set to deploy with **GitHub Actions**.
3+
4+
name: Jupyter Book (via myst) GitHub Pages Deploy
5+
on:
6+
push:
7+
# Runs on pushes targeting the default branch
8+
branches: [main]
9+
env:
10+
# `BASE_URL` determines, relative to the root of the domain, the URL that your site is served from.
11+
# E.g., if your site lives at `https://mydomain.org/myproject`, set `BASE_URL=/myproject`.
12+
# If, instead, your site lives at the root of the domain, at `https://mydomain.org`, set `BASE_URL=''`.
13+
BASE_URL: '' # Not required for 'methodes-cogneuro.github.io' domain. Other repos will need to set this!
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
22+
concurrency:
23+
group: 'pages'
24+
cancel-in-progress: false
25+
jobs:
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- name: Setup Pages
34+
uses: actions/configure-pages@v3
35+
- uses: actions/setup-node@v4
36+
with:
37+
node-version: 18.x
38+
- name: Install Jupyter Book (via myst)
39+
run: npm install -g jupyter-book
40+
- name: Build HTML Assets
41+
run: jupyter-book build --html
42+
- name: Upload artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: './_build/html'
46+
- name: Deploy to GitHub Pages
47+
id: deployment
48+
uses: actions/deploy-pages@v4

README.md

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,38 +20,19 @@ Si vous souhaitez développer et construire les notes de cours PSY3018, vous dev
2020

2121
- Clonez ce repository
2222
- Exécutez `pip install -r requirements.txt` (il est recommandé d'effectuer cette commande dans un environnement virtuel).
23-
- (Recommendé) Effacez le répertoire `_build/`
24-
- On exporte l'URL de base à utiliser: `export BASE_URL="https://methodes-cogneuro.github.io"`
23+
- Modifier le contenu du livre à partir des fichiers `md`
2524
- Exécutez les notebooks (uniquement si vous avez changé le code) `jupyter book build --execute`
26-
- Générer le site en html `jupyter book build --html`
25+
- Si vous souhaitez avoir un apercu du site web: `jupyter book start`
2726

2827

29-
Une version statique html du livre sera générée dans `_build/html/`.
30-
3128
### Hosting the book
32-
33-
The html version of the book is hosted on the `gh-pages` branch of this repo. Navigate to your local build and run,
34-
- `ghp-import -n -p -f _build/html`
35-
36-
This will automatically push your build to the `gh-pages` branch. More information on this hosting process can be found [here](https://jupyterbook.org/publish/gh-pages.html#manually-host-your-book-with-github-pages).
37-
38-
### Generating pdf
39-
40-
The support for pdf generation is experimental with jupyter book, and the output is not perfect. Currently the process looks like:
41-
* install the depencies described in the section "Building a pdf with latex" in the [jb docs](https://jupyterbook.org/advanced/pdf.html).
42-
* build latex with individual pages: `jb build methodes_neurocog/ --builder pdflatex --individualpages`. This produces warnings (skip them) and errors. If you ever get stuck in the terminal, leaving the weird latex compilation environment is achieved by pressing `X` (you're welcome).
43-
* install xetex `sudo apt-get install texlive-xetex`
44-
* go in the build directory `cd methodes_neurocog/_build/latex`
45-
* edit manually the `tex` file of the chapter. Replace all `\chapter` by `\section` and add a proper `\chapter` at the beginning. You can also search `Content` and replace by `Table des matières`. I have tried to switch the whole doc in French but without success so far.
46-
* before adding the chapter title, add the following lines: `\setcounter{chapter}{n} \addtocounter{chapter}{-1}`, where `n` is the number of the chapter.
47-
* Compile a chapter, e.g. `xelatex cartes_cerebrales.tex`
48-
* the resulting pdf is mega-huge. So shrink it with `gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dNOPAUSE -dQUIET -dBATCH -sOutputFile=notes_cours_cartes_cerebrales.pdf -dPDFSETTINGS=/ebook cartes_cerebrales.pdf`
49-
* Voilà 🎉 🎉 🎉
29+
- Ouvrir une pull request pour faire des changements.
30+
- Une fois les changements importés dans `main` une action github va construire le livre automatiquement.
5031

5132
## Contributors
5233

5334
We welcome and recognize all contributions. You can see a list of current contributors in the [contributors tab](https://github.com/psy3018/notes_cours_psy3018/graphs/contributors).
5435

5536
## Credits
5637

57-
This project is created using the excellent open source [Jupyter Book project](https://jupyterbook.org/) and the [executablebooks/cookiecutter-jupyter-book template](https://github.com/executablebooks/cookiecutter-jupyter-book). Further credits for the book can be found in the book itself.
38+
This project is created using the excellent open source [Jupyter Book project](https://jupyterbook.org/). Further credits for the contributors of the book can be found in the book itself.

0 commit comments

Comments
 (0)