|
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 |
| 1 | +name: Jupyter Book v2 (MyST) GitHub Pages Deploy |
5 | 2 |
|
6 | 3 | on: |
7 | 4 | push: |
8 | 5 | branches: [main] |
9 | 6 | workflow_dispatch: |
10 | 7 |
|
11 | 8 | env: |
12 | | - # If your site lives at https://<org>.github.io/<repo>, keep this: |
13 | 9 | BASE_URL: /${{ github.event.repository.name }} |
14 | 10 |
|
15 | 11 | permissions: |
@@ -38,22 +34,38 @@ jobs: |
38 | 34 | with: |
39 | 35 | node-version: 18.x |
40 | 36 |
|
41 | | - - name: Install Jupyter Book (via myst) |
42 | | - run: npm install -g jupyter-book |
| 37 | + - name: Install MyST Markdown (mystmd) |
| 38 | + run: npm install -g mystmd |
43 | 39 |
|
44 | 40 | - name: Build HTML Assets |
| 41 | + id: build |
45 | 42 | run: | |
46 | | - # Some versions expect a path argument, others build from CWD: |
47 | | - jupyter-book build --html . || jupyter-book build --html |
| 43 | + set -euxo pipefail |
| 44 | +
|
| 45 | + # Find the MyST/Jupyter Book v2 project root |
| 46 | + MYST_FILE="$(find . -maxdepth 3 -name myst.yml -print -quit || true)" |
| 47 | + if [ -z "$MYST_FILE" ]; then |
| 48 | + echo "ERROR: Could not find myst.yml (Jupyter Book v2 requires it)." |
| 49 | + echo "Repo contents:" |
| 50 | + ls -lah |
| 51 | + exit 1 |
| 52 | + fi |
| 53 | +
|
| 54 | + MYST_DIR="$(cd "$(dirname "$MYST_FILE")" && pwd)" |
| 55 | + echo "Building from: $MYST_DIR" |
| 56 | +
|
| 57 | + cd "$MYST_DIR" |
| 58 | + myst build --html |
48 | 59 |
|
49 | | - # Fail here (with a clear error) instead of later during upload: |
50 | 60 | test -d _build/html |
51 | 61 | ls -lah _build/html |
52 | 62 |
|
| 63 | + echo "html_path=$MYST_DIR/_build/html" >> "$GITHUB_OUTPUT" |
| 64 | +
|
53 | 65 | - name: Upload artifact |
54 | 66 | uses: actions/upload-pages-artifact@v3 |
55 | 67 | with: |
56 | | - path: _build/html |
| 68 | + path: ${{ steps.build.outputs.html_path }} |
57 | 69 |
|
58 | 70 | - name: Deploy to GitHub Pages |
59 | 71 | id: deployment |
|
0 commit comments