|
| 1 | +name: Deploy docs to GitHub Pages |
| 2 | + |
| 3 | +# Publishes every HTML file under docs/ to GitHub Pages and auto-generates |
| 4 | +# an index.html linking to each deck. Enables Pages (GitHub Actions source) |
| 5 | +# on first run via actions/configure-pages enablement. |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: [main] |
| 10 | + paths: |
| 11 | + - 'docs/**.html' |
| 12 | + - '.github/workflows/pages.yml' |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + pages: write |
| 18 | + id-token: write |
| 19 | + |
| 20 | +concurrency: |
| 21 | + group: pages |
| 22 | + cancel-in-progress: true |
| 23 | + |
| 24 | +jobs: |
| 25 | + deploy: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + environment: |
| 28 | + name: github-pages |
| 29 | + url: ${{ steps.deployment.outputs.page_url }} |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + |
| 33 | + - name: Generate index of HTML decks |
| 34 | + run: | |
| 35 | + cd docs |
| 36 | + { |
| 37 | + echo '<!DOCTYPE html><html lang="en"><head><meta charset="utf-8">' |
| 38 | + echo '<meta name="viewport" content="width=device-width, initial-scale=1">' |
| 39 | + echo '<title>Altinity MCP — docs</title>' |
| 40 | + echo '<style>body{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;background:#0d0f16;color:#e7eaf2;max-width:760px;margin:8vh auto;padding:0 24px}a{color:#ffcc33;text-decoration:none}a:hover{text-decoration:underline}h1{letter-spacing:-.02em}li{margin:.55em 0;font-size:18px}.m{color:#94a0bb;font-size:.85em}code{color:#cfe3ff}</style>' |
| 41 | + echo '</head><body><h1>Altinity MCP — docs</h1>' |
| 42 | + echo '<p class="m">HTML decks & references published from <code>/docs</code>.</p><ul>' |
| 43 | + for f in *.html; do |
| 44 | + [ "$f" = "index.html" ] && continue |
| 45 | + [ -e "$f" ] || continue |
| 46 | + title=$(grep -oiE '<title>[^<]*' "$f" | head -1 | sed -E 's/<title>//I') |
| 47 | + [ -z "$title" ] && title="$f" |
| 48 | + echo "<li><a href=\"./$f\">$title</a> <span class=\"m\">— $f</span></li>" |
| 49 | + done |
| 50 | + echo '</ul></body></html>' |
| 51 | + } > index.html |
| 52 | + echo "::group::generated index.html"; cat index.html; echo "::endgroup::" |
| 53 | +
|
| 54 | + - name: Configure Pages (enables Pages on first run) |
| 55 | + uses: actions/configure-pages@v5 |
| 56 | + with: |
| 57 | + enablement: true |
| 58 | + |
| 59 | + - name: Upload docs/ as Pages artifact |
| 60 | + uses: actions/upload-pages-artifact@v3 |
| 61 | + with: |
| 62 | + path: docs |
| 63 | + |
| 64 | + - name: Deploy to GitHub Pages |
| 65 | + id: deployment |
| 66 | + uses: actions/deploy-pages@v4 |
0 commit comments