Skip to content

Commit 9bc9905

Browse files
committed
Host shared Pages from manifest registry
1 parent d7e7f2b commit 9bc9905

File tree

2 files changed

+93
-2
lines changed

2 files changed

+93
-2
lines changed

.github/workflows/pages.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
env:
10+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: pages
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/configure-pages@v5
26+
env:
27+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
28+
29+
- name: Prepare site
30+
shell: bash
31+
run: |
32+
set -euo pipefail
33+
mkdir -p site/auxiliary
34+
mkdir -p site/metrics
35+
curl -L --fail \
36+
-o site/auxiliary/nabla-glow.svg \
37+
https://github.com/Devsh-Graphics-Programming/Nabla-Asset-Manifests/releases/download/pages-assets/nabla-glow.svg
38+
curl -L --fail \
39+
-o site/auxiliary/externaldata-flow-kitware.jpg \
40+
https://github.com/Devsh-Graphics-Programming/Nabla-Asset-Manifests/releases/download/pages-assets/externaldata-flow-kitware.jpg
41+
git clone --quiet https://github.com/Devsh-Graphics-Programming/Nabla-Asset-Module.git module-repo-size-check
42+
git clone --quiet https://github.com/Devsh-Graphics-Programming/Nabla-Asset-Manifests.git manifests-repo-size-check
43+
python - <<'PY'
44+
import json
45+
from pathlib import Path
46+
47+
def repo_size_payload(label_repo: str, clone_dir: str) -> tuple[str, dict[str, object]]:
48+
pack_dir = Path(clone_dir) / ".git" / "objects" / "pack"
49+
total = sum(path.stat().st_size for path in pack_dir.glob("*"))
50+
kib = (total + 1023) // 1024
51+
payload = {
52+
"schemaVersion": 1,
53+
"label": "repo size",
54+
"message": f"{kib} KiB",
55+
"color": "blue",
56+
}
57+
return label_repo, payload
58+
59+
outputs = dict(
60+
[
61+
repo_size_payload("nabla-asset-module", "module-repo-size-check"),
62+
repo_size_payload("nabla-asset-manifests", "manifests-repo-size-check"),
63+
]
64+
)
65+
metrics_dir = Path("site/metrics")
66+
for repo_name, payload in outputs.items():
67+
(metrics_dir / f"{repo_name}-repo-size.json").write_text(
68+
json.dumps(payload),
69+
encoding="utf-8",
70+
)
71+
PY
72+
printf '%s\n' '<!doctype html><meta charset="utf-8"><title>Nabla Asset Manifests Pages</title>' > site/index.html
73+
touch site/.nojekyll
74+
75+
- uses: actions/upload-pages-artifact@v4
76+
env:
77+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
78+
with:
79+
path: site
80+
81+
deploy:
82+
needs: build
83+
runs-on: ubuntu-latest
84+
environment:
85+
name: github-pages
86+
url: ${{ steps.deployment.outputs.page_url }}
87+
steps:
88+
- id: deployment
89+
uses: actions/deploy-pages@v4
90+
env:
91+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<div align="center">
2-
<img alt="Click to see the source" height="200" src="https://devsh-graphics-programming.github.io/Nabla-Asset-Module/auxiliary/nabla-glow.svg" width="200" />
2+
<img alt="Click to see the source" height="200" src="https://devsh-graphics-programming.github.io/Nabla-Asset-Manifests/auxiliary/nabla-glow.svg" width="200" />
33
</div>
44

55
<p align="center">
66
<a href="https://github.com/Devsh-Graphics-Programming/Nabla-Asset-Manifests">
7-
<img src="https://img.shields.io/github/repo-size/Devsh-Graphics-Programming/Nabla-Asset-Manifests" alt="Repository size" /></a>
7+
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdevsh-graphics-programming.github.io%2FNabla-Asset-Manifests%2Fmetrics%2Fnabla-asset-manifests-repo-size.json" alt="Repository size" /></a>
88
<a href="https://opensource.org/licenses/Apache-2.0">
99
<img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="License: Apache 2.0" /></a>
1010
<a href="https://discord.gg/krsBcABm7u">

0 commit comments

Comments
 (0)