-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (83 loc) · 2.94 KB
/
pages.yml
File metadata and controls
93 lines (83 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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'