Skip to content

Commit f849175

Browse files
authored
Update deploy.yml
1 parent cb7f958 commit f849175

1 file changed

Lines changed: 23 additions & 11 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
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
52

63
on:
74
push:
85
branches: [main]
96
workflow_dispatch:
107

118
env:
12-
# If your site lives at https://<org>.github.io/<repo>, keep this:
139
BASE_URL: /${{ github.event.repository.name }}
1410

1511
permissions:
@@ -38,22 +34,38 @@ jobs:
3834
with:
3935
node-version: 18.x
4036

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
4339

4440
- name: Build HTML Assets
41+
id: build
4542
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
4859
49-
# Fail here (with a clear error) instead of later during upload:
5060
test -d _build/html
5161
ls -lah _build/html
5262
63+
echo "html_path=$MYST_DIR/_build/html" >> "$GITHUB_OUTPUT"
64+
5365
- name: Upload artifact
5466
uses: actions/upload-pages-artifact@v3
5567
with:
56-
path: _build/html
68+
path: ${{ steps.build.outputs.html_path }}
5769

5870
- name: Deploy to GitHub Pages
5971
id: deployment

0 commit comments

Comments
 (0)