diff --git a/.github/workflows/deploy2.yml b/.github/workflows/deploy2.yml new file mode 100644 index 0000000..bc252ac --- /dev/null +++ b/.github/workflows/deploy2.yml @@ -0,0 +1,79 @@ +name: MyST GitHub Pages Deploy + +on: + push: + branches: [main] + +env: + REPO: PySim + BOOK_DIR: book + BASE_URL: /PySim + +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 + + # Build MAIN site (myst.yml lives in book/) + - name: Build MAIN HTML + shell: bash + run: | + set -euo pipefail + cd "${BOOK_DIR}" + myst build --execute --html + + # Build JB2 site and copy into MAIN output under /JB2 + - name: Build JB2 HTML into /PySim/JB2 + shell: bash + run: | + set -euo pipefail + + git fetch --all --prune + git worktree add ../_JB2_build JB2 + + # Build inside JB2 worktree, from book/ + pushd ../_JB2_build/${BOOK_DIR} + BASE_URL=/${REPO}/JB2 myst build --execute --html + popd + + # Copy JB2 output into MAIN output folder + rm -rf ${BOOK_DIR}/_build/html/JB2 + mkdir -p ${BOOK_DIR}/_build/html/JB2 + cp -a ../_JB2_build/${BOOK_DIR}/_build/html/. ${BOOK_DIR}/_build/html/JB2/ + + git worktree remove ../_JB2_build --force + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './book/_build/html' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4