diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c77e2e1..ebc3c81 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -29,42 +29,132 @@ jobs: - name: Configure Pages uses: actions/configure-pages@v5 - - name: Aggregate files from all branches into ./public + - name: Aggregate and build recursive directory pages shell: bash run: | set -euo pipefail + + OWNER="${GITHUB_REPOSITORY%/*}" + REPO="${GITHUB_REPOSITORY#*/}" + SITE_ROOT="/${REPO}/" + mkdir -p public + : > public/.nojekyll - # List remote branches (exclude HEAD pointer) - mapfile -t BRANCHES < <(git ls-remote --heads origin \ - | awk '{print $2}' | sed 's@refs/heads/@@') + # List remote branches + mapfile -t BRANCHES < <( + git ls-remote --heads origin | awk '{print $2}' \ + | sed 's@refs/heads/@@' + ) - # Minimal index page + # Top-level landing page cat > public/index.html <<'HTML' - - Branches

Branches

" >> public/index.html - echo "Built public/ for ${#BRANCHES[@]} branches." + + # Finish landing page with JS to render branch cards + cat >> public/index.html <<'HTML' + + HTML - name: Upload Pages artifact uses: actions/upload-pages-artifact@v4 @@ -73,4 +163,4 @@ jobs: - name: Deploy to GitHub Pages id: deploy - uses: actions/deploy-pages@v4 + uses: actions/deploy-pages@v4 \ No newline at end of file