From cb4278e162b0ccf3b64a3edc027291ecf6ad6653 Mon Sep 17 00:00:00 2001 From: FreekPols Date: Thu, 22 Jan 2026 11:06:53 +0100 Subject: [PATCH 1/5] deploy file --- .github/workflows/deploy2.yml | 75 +++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/deploy2.yml diff --git a/.github/workflows/deploy2.yml b/.github/workflows/deploy2.yml new file mode 100644 index 0000000..23db5bf --- /dev/null +++ b/.github/workflows/deploy2.yml @@ -0,0 +1,75 @@ +# This file was created automatically with `myst init --gh-pages` 🪄 💚 +# Ensure your GitHub Pages settings for this repository are set to deploy with **GitHub Actions**. + +name: MyST GitHub Pages Deploy +on: + push: + # Runs on pushes targeting the default branch + branches: [main] + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. +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 + + - name: Build HTML (JB2) into subpath + run: | + # Check out JB2 branch into a separate folder + git worktree add ../_JB2_build JB2 + + # Build JB2 with BASE_URL pointing to //JB2 + cd ../_JB2_build + BASE_URL=/${{ github.event.repository.name }}/JB2 myst build --execute --html + + # Copy JB2 site into main site's build folder under /JB2 + cd - + rm -rf _build/html/JB2 + mkdir -p _build/html/JB2 + cp -a ../_JB2_build/_build/html/. _build/html/JB2/ + + # Clean up worktree + 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 + + # - name: Push to GitLab + # run: | + # git config --global user.name "GitHub Actions" + # git config --global user.email "actions@github.com" + + # # Add GitLab as a remote (update URL for your repo) + # git remote add gitlab https://oauth2:${{ secrets.GLGH_PAT }}@gitlab.tudelft.nl/opentextbooks/MeRela.git + # # Use force-with-lease for safety + # git push gitlab \ No newline at end of file From 4263727a543b5176c47508f774504d916a97b3bd Mon Sep 17 00:00:00 2001 From: FreekPols Date: Thu, 22 Jan 2026 11:15:31 +0100 Subject: [PATCH 2/5] 2nd test for deploy --- .github/workflows/deploy2.yml | 65 +++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/.github/workflows/deploy2.yml b/.github/workflows/deploy2.yml index 23db5bf..60d8977 100644 --- a/.github/workflows/deploy2.yml +++ b/.github/workflows/deploy2.yml @@ -1,34 +1,38 @@ # This file was created automatically with `myst init --gh-pages` 🪄 💚 -# Ensure your GitHub Pages settings for this repository are set to deploy with **GitHub Actions**. - name: MyST GitHub Pages Deploy + on: push: - # Runs on pushes targeting the default branch branches: [main] -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +env: + # main site served from / + BASE_URL: /${{ github.event.repository.name }} + permissions: contents: read pages: write id-token: write -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. + 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 @@ -36,24 +40,43 @@ jobs: - name: Install MyST Markdown run: npm install -g mystmd - - name: Build HTML (JB2) into subpath + # 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: | - # Check out JB2 branch into a separate folder + set -euo pipefail + + # 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 pointing to //JB2 - cd ../_JB2_build + + # Build JB2 with BASE_URL //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 - cd - rm -rf _build/html/JB2 mkdir -p _build/html/JB2 cp -a ../_JB2_build/_build/html/. _build/html/JB2/ - - # Clean up worktree - git worktree remove ../_JB2_build --force + # Clean up + git worktree remove ../_JB2_build --force - name: Upload artifact uses: actions/upload-pages-artifact@v3 @@ -63,13 +86,3 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 - - # - name: Push to GitLab - # run: | - # git config --global user.name "GitHub Actions" - # git config --global user.email "actions@github.com" - - # # Add GitLab as a remote (update URL for your repo) - # git remote add gitlab https://oauth2:${{ secrets.GLGH_PAT }}@gitlab.tudelft.nl/opentextbooks/MeRela.git - # # Use force-with-lease for safety - # git push gitlab \ No newline at end of file From 6d7f481f640020e65e826a3891d19e36fab87d63 Mon Sep 17 00:00:00 2001 From: FreekPols Date: Thu, 22 Jan 2026 11:22:45 +0100 Subject: [PATCH 3/5] 3rd attempt --- .github/workflows/deploy2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy2.yml b/.github/workflows/deploy2.yml index 60d8977..3ce2447 100644 --- a/.github/workflows/deploy2.yml +++ b/.github/workflows/deploy2.yml @@ -49,7 +49,7 @@ jobs: shell: bash run: | set -euo pipefail - + cd "${BOOK_DIR}" # Ensure branch is available locally git fetch --all --prune From 5aaf40d51d11aec2ef0708354aa02790ad2b77b3 Mon Sep 17 00:00:00 2001 From: FreekPols Date: Thu, 22 Jan 2026 11:24:08 +0100 Subject: [PATCH 4/5] 4th --- .github/workflows/deploy2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy2.yml b/.github/workflows/deploy2.yml index 3ce2447..177f87f 100644 --- a/.github/workflows/deploy2.yml +++ b/.github/workflows/deploy2.yml @@ -49,7 +49,7 @@ jobs: shell: bash run: | set -euo pipefail - cd "${BOOK_DIR}" + cd "${book}" # Ensure branch is available locally git fetch --all --prune From cb49594d976b9921b0181ca216443bd40fb99c61 Mon Sep 17 00:00:00 2001 From: FreekPols Date: Thu, 22 Jan 2026 11:25:08 +0100 Subject: [PATCH 5/5] incl folder book --- .github/workflows/deploy2.yml | 49 ++++++++++++++--------------------- 1 file changed, 20 insertions(+), 29 deletions(-) diff --git a/.github/workflows/deploy2.yml b/.github/workflows/deploy2.yml index 177f87f..bc252ac 100644 --- a/.github/workflows/deploy2.yml +++ b/.github/workflows/deploy2.yml @@ -1,4 +1,3 @@ -# This file was created automatically with `myst init --gh-pages` 🪄 💚 name: MyST GitHub Pages Deploy on: @@ -6,8 +5,9 @@ on: branches: [main] env: - # main site served from / - BASE_URL: /${{ github.event.repository.name }} + REPO: PySim + BOOK_DIR: book + BASE_URL: /PySim permissions: contents: read @@ -40,48 +40,39 @@ jobs: - name: Install MyST Markdown run: npm install -g mystmd - # 1) Build MAIN site + # Build MAIN site (myst.yml lives in book/) - name: Build MAIN HTML - run: myst build --execute --html + shell: bash + run: | + set -euo pipefail + cd "${BOOK_DIR}" + myst build --execute --html - # 2) Build JB2 site into a subpath and copy it into main output - - name: Build JB2 HTML into subpath + # Build JB2 site and copy into MAIN output under /JB2 + - name: Build JB2 HTML into /PySim/JB2 shell: bash run: | set -euo pipefail - cd "${book}" - # Ensure branch is available locally - git fetch --all --prune - # Add JB2 as a worktree + git fetch --all --prune git worktree add ../_JB2_build JB2 - # Build JB2 with BASE_URL //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) - + # Build inside JB2 worktree, from book/ + pushd ../_JB2_build/${BOOK_DIR} + BASE_URL=/${REPO}/JB2 myst build --execute --html 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/ + # 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/ - # Clean up git worktree remove ../_JB2_build --force - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: './_build/html' + path: './book/_build/html' - name: Deploy to GitHub Pages id: deployment