@@ -289,3 +289,64 @@ jobs:
289289 # uses: github/codeql-action/upload-sarif@v3 # https://github.com/github/codeql-action
290290 # with:
291291 # sarif_file: 'scout-results.sarif.json'
292+
293+ # ---------------------------------------------------------------------------------------
294+
295+ publish-docs :
296+
297+ # ---------------------------------------------------------------------------------------
298+
299+ name : " Publish Docs to gh-pages"
300+
301+ needs : build
302+ runs-on : ubuntu-latest
303+
304+ # run this job only on main branch or on tags, this avoids running on PRs
305+ if : github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
306+
307+ steps :
308+
309+ - name : 🤘 Checkout gh-pages branch
310+ uses : actions/checkout@v4
311+ with :
312+ ref : gh-pages
313+ fetch-depth : 1
314+
315+ - name : 🔽 Download all docs artifacts
316+ uses : actions/download-artifact@v4
317+ with :
318+ pattern : version-info-*
319+ merge-multiple : true
320+ path : tmp
321+
322+ - name : 📝 Merge both READMEs into a Github Pages index.md
323+ run : |
324+ cd tmp
325+ echo "# cpp-devbox ${{ github.ref_name }} ($(date '+%Y-%m-%d'))" > index.md
326+ echo "" >> index.md
327+ echo "## Images" >> index.md
328+ echo "" >> index.md
329+ for codename in bookworm trixie; do
330+ if [ -f README-${codename}-base.md ]; then
331+ echo "### Base Image (${codename})" >> index.md
332+ grep -A2 '^OS Version:' README-${codename}-base.md >> index.md
333+ echo "" >> index.md
334+ fi
335+ if [ -f README-${codename}-with-vulkansdk.md ]; then
336+ echo "### With VulkanSDK (${codename})" >> index.md
337+ grep -A2 '^OS Version:' README-${codename}-with-vulkansdk.md >> index.md
338+ echo "" >> index.md
339+ fi
340+ done
341+
342+ - name : ✔ Commit index.md to gh-pages branch
343+ run : |
344+ cp tmp/index.md index.md
345+ git config --global user.name "github-actions[bot]"
346+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
347+ git add index.md
348+ git commit -m "Publish docs from ${GITHUB_REPOSITORY}@${GITHUB_SHA:0:9}"
349+
350+ - name : 🚀 Push to gh-pages branch
351+ run : |
352+ git push origin gh-pages
0 commit comments