Pages #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pages | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/configure-pages@v5 | |
| with: | |
| enablement: true | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| - name: Prepare site | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mkdir -p site/auxiliary | |
| mkdir -p site/metrics | |
| curl -L --fail \ | |
| -o site/auxiliary/nabla-glow.svg \ | |
| https://github.com/Devsh-Graphics-Programming/Nabla-Asset-Manifests/releases/download/pages-assets/nabla-glow.svg | |
| curl -L --fail \ | |
| -o site/auxiliary/externaldata-flow-kitware.jpg \ | |
| https://github.com/Devsh-Graphics-Programming/Nabla-Asset-Manifests/releases/download/pages-assets/externaldata-flow-kitware.jpg | |
| git clone --quiet https://github.com/Devsh-Graphics-Programming/Nabla-Asset-Module.git module-repo-size-check | |
| git clone --quiet https://github.com/Devsh-Graphics-Programming/Nabla-Asset-Manifests.git manifests-repo-size-check | |
| python - <<'PY' | |
| import json | |
| from pathlib import Path | |
| def repo_size_payload(label_repo: str, clone_dir: str) -> tuple[str, dict[str, object]]: | |
| pack_dir = Path(clone_dir) / ".git" / "objects" / "pack" | |
| total = sum(path.stat().st_size for path in pack_dir.glob("*")) | |
| kib = (total + 1023) // 1024 | |
| payload = { | |
| "schemaVersion": 1, | |
| "label": "repo size", | |
| "message": f"{kib} KiB", | |
| "color": "blue", | |
| } | |
| return label_repo, payload | |
| outputs = dict( | |
| [ | |
| repo_size_payload("nabla-asset-module", "module-repo-size-check"), | |
| repo_size_payload("nabla-asset-manifests", "manifests-repo-size-check"), | |
| ] | |
| ) | |
| metrics_dir = Path("site/metrics") | |
| for repo_name, payload in outputs.items(): | |
| (metrics_dir / f"{repo_name}-repo-size.json").write_text( | |
| json.dumps(payload), | |
| encoding="utf-8", | |
| ) | |
| PY | |
| printf '%s\n' '<!doctype html><meta charset="utf-8"><title>Nabla Asset Manifests Pages</title>' > site/index.html | |
| touch site/.nojekyll | |
| - uses: actions/upload-pages-artifact@v4 | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| with: | |
| path: site | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' |