3rd attempt #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This file was created automatically with `myst init --gh-pages` 🪄 💚 | |
| name: MyST GitHub Pages Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| env: | |
| # main site served from /<repo> | |
| BASE_URL: /${{ github.event.repository.name }} | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v3 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18.x | |
| - name: Install MyST Markdown | |
| run: npm install -g mystmd | |
| # 1) Build MAIN site | |
| - name: Build MAIN HTML | |
| run: myst build --execute --html | |
| # 2) Build JB2 site into a subpath and copy it into main output | |
| - name: Build JB2 HTML into subpath | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| cd "${BOOK_DIR}" | |
| # Ensure branch is available locally | |
| git fetch --all --prune | |
| # Add JB2 as a worktree | |
| git worktree add ../_JB2_build JB2 | |
| # Build JB2 with BASE_URL /<repo>/JB2 | |
| pushd ../_JB2_build | |
| # Optional but helpful diagnostics: | |
| ls -la | |
| test -f myst.yml || (echo "JB2 branch mist myst.yml (met site:). Voeg een site-config toe." && exit 1) | |
| BASE_URL=/${{ github.event.repository.name }}/JB2 myst build --execute --html | |
| # Ensure output exists | |
| test -d _build/html || (echo "JB2 build leverde geen _build/html op. Waarschijnlijk ontbreekt 'site:' in myst.yml." && exit 1) | |
| popd | |
| # Copy JB2 site into main site's build folder under /JB2 | |
| rm -rf _build/html/JB2 | |
| mkdir -p _build/html/JB2 | |
| cp -a ../_JB2_build/_build/html/. _build/html/JB2/ | |
| # Clean up | |
| git worktree remove ../_JB2_build --force | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './_build/html' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |