Repository navigation
65 lines (55 loc) · 1.62 KB
/
Copy pathdeploy.yml
File metadata and controls
65 lines (55 loc) · 1.62 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
name: Deploy JSON to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v6
- name: Configure GitHub Pages
uses: actions/configure-pages@v5
- name: Build JSON endpoints
shell: python3 {0}
run: |
import json
import subprocess
from pathlib import Path
output = Path("_site")
output.mkdir()
sources = subprocess.check_output(
["git", "ls-files", "-z", "--", "*.json", ":(exclude)*.schema.json"]
).decode("utf-8").split("\0")
for name in filter(None, sources):
source = Path(name)
data = json.loads(source.read_text(encoding="utf-8"))
target = output / source.with_suffix("")
target.parent.mkdir(parents=True, exist_ok=True)
target.write_text(
json.dumps(data, ensure_ascii=False, separators=(",", ":"), allow_nan=False),
encoding="utf-8",
)
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: _site
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4