name: Docs Build on: push: branches: [main] paths: - "docs/**" workflow_dispatch: defaults: run: shell: bash env: MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: build: runs-on: build-arm64 container: image: ghcr.io/nvidia/openshell/ci:latest credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout uses: actions/checkout@v4 - name: Install tools run: mise install - name: Build documentation run: mise run docs:build:strict - name: Delete unnecessary files run: | find _build -name .doctrees -prune -exec rm -rf {} \; find _build -name .buildinfo -exec rm {} \; - name: Upload HTML uses: actions/upload-artifact@v4 with: name: html-build-artifact path: _build/docs if-no-files-found: error retention-days: 1 publish: if: false # disabled until GitHub Pages is configured needs: [build] runs-on: build-arm64 container: image: ghcr.io/nvidia/openshell/ci:latest credentials: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} steps: - uses: actions/checkout@v4 with: ref: "gh-pages" - name: Initialize Git configuration run: | git config --global --add safe.directory "$GITHUB_WORKSPACE" git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" - name: Download artifacts uses: actions/download-artifact@v4 with: name: html-build-artifact path: ${{ github.ref_name }} - name: Copy HTML directories run: | ls -asl for i in `ls -d *` do echo "Git adding ${i}" git add "${i}" done - name: Check or create dot-no-jekyll file run: | if [ -f ".nojekyll" ]; then echo "The dot-no-jekyll file already exists." exit 0 fi touch .nojekyll git add .nojekyll - name: Check or create redirect page env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | resp=$(grep 'http-equiv="refresh"' index.html 2>/dev/null) || true if [ -n "${resp}" ]; then echo "The redirect file already exists." exit 0 fi def_branch=$(gh api "repos/${GITHUB_REPOSITORY}" --jq ".default_branch") html_url=$(gh api "repos/${GITHUB_REPOSITORY}/pages" --jq ".html_url") echo '' > index.html echo '' >> index.html echo ' ' >> index.html echo ' Redirect to documentation' >> index.html echo ' ' >> index.html echo ' ' >> index.html echo ' ' >> index.html echo ' ' >> index.html echo ' ' >> index.html echo ' ' >> index.html echo '

Please follow the link to the ' >> index.html echo ${def_branch}' branch documentation.

' >> index.html echo ' ' >> index.html echo '' >> index.html git add index.html - name: Commit changes to the GitHub Pages branch run: | git status if git commit -m 'Pushing changes to GitHub Pages.'; then git push -f else echo "Nothing changed." fi