|
| 1 | +name: Deploy Diagrams (GitHub Pages) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - "docs/diagrams/**" |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + pages: write |
| 14 | + id-token: write |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: "pages" |
| 18 | + cancel-in-progress: false |
| 19 | + |
| 20 | +jobs: |
| 21 | + deploy: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + environment: |
| 24 | + name: github-pages |
| 25 | + url: ${{ steps.deployment.outputs.page_url }} |
| 26 | + steps: |
| 27 | + - uses: actions/checkout@v4 |
| 28 | + |
| 29 | + - name: Generate index page |
| 30 | + working-directory: docs/diagrams |
| 31 | + run: | |
| 32 | + set -euo pipefail |
| 33 | +
|
| 34 | + primary=() |
| 35 | + for f in *.html; do |
| 36 | + [[ "$f" == *.visual-check.html ]] && continue |
| 37 | + primary+=("$f") |
| 38 | + done |
| 39 | +
|
| 40 | + { |
| 41 | + echo "<!doctype html>" |
| 42 | + echo "<html lang=\"en\"><head><meta charset=\"utf-8\">" |
| 43 | + echo "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">" |
| 44 | + echo "<title>IoTPowerShellAgent Diagrams</title>" |
| 45 | + echo "<style>" |
| 46 | + echo "body{background:#0b0d12;color:#e6e8ee;font-family:ui-monospace,Consolas,monospace;padding:2rem;max-width:760px;margin:0 auto}" |
| 47 | + echo "h1{font-size:1.4rem;margin-bottom:1.5rem}" |
| 48 | + echo "ul{list-style:none;padding:0}" |
| 49 | + echo "li{margin-bottom:0.75rem;padding:0.75rem 1rem;border:1px solid #2a2e3a;border-radius:8px}" |
| 50 | + echo "a{color:#7dd3fc;text-decoration:none;font-weight:600}" |
| 51 | + echo "a:hover{text-decoration:underline}" |
| 52 | + echo ".sub{display:block;margin-top:0.35rem;font-size:0.85rem;color:#9aa3b2}" |
| 53 | + echo ".sub a{color:#9aa3b2;font-weight:400}" |
| 54 | + echo "</style></head><body>" |
| 55 | + echo "<h1>IoTPowerShellAgent — Diagrams</h1>" |
| 56 | + echo "<ul>" |
| 57 | + for f in "${primary[@]}"; do |
| 58 | + name="${f%.html}" |
| 59 | + check="${name}.visual-check.html" |
| 60 | + echo "<li><a href=\"${f}\">${name}</a>" |
| 61 | + if [[ -f "$check" ]]; then |
| 62 | + echo "<span class=\"sub\">↳ <a href=\"${check}\">visual-check contact sheet</a></span>" |
| 63 | + fi |
| 64 | + echo "</li>" |
| 65 | + done |
| 66 | + echo "</ul></body></html>" |
| 67 | + } > index.html |
| 68 | +
|
| 69 | + - name: Configure Pages |
| 70 | + uses: actions/configure-pages@v5 |
| 71 | + |
| 72 | + - name: Upload artifact |
| 73 | + uses: actions/upload-pages-artifact@v3 |
| 74 | + with: |
| 75 | + path: docs/diagrams |
| 76 | + |
| 77 | + - name: Deploy to GitHub Pages |
| 78 | + id: deployment |
| 79 | + uses: actions/deploy-pages@v4 |
0 commit comments