This repository was archived by the owner on Aug 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (88 loc) · 3.21 KB
/
Copy pathdeploy-viewer.yml
File metadata and controls
101 lines (88 loc) · 3.21 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
94
95
96
97
98
99
100
101
name: Deploy custom bblocks-viewer
on:
workflow_run:
workflows: ["Validate and process Building Blocks"]
types: [completed]
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
jobs:
deploy-viewer:
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get GitHub Pages URL
id: pages-url
run: |
FALLBACK="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/"
URL=$(gh api repos/${{ github.repository }}/pages --jq '.html_url // empty' 2>/dev/null) || true
if [ -z "$URL" ]; then
URL="$FALLBACK"
fi
echo "url=$URL" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
- name: Read repo title from bblocks-config.yaml
id: config
run: |
TITLE=$(grep '^name:' bblocks-config.yaml | sed 's/^name: *//')
echo "title=$TITLE" >> "$GITHUB_OUTPUT"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Augment register.json with resolvedSchema URLs
run: python tools/augment_register.py
- name: Generate custom validation report
run: python tools/generate_custom_report.py --input build/tests/report.json --output build/tests/report.html
- name: Generate config.js and index.html
run: |
PAGES_URL="${{ steps.pages-url.outputs.url }}"
TITLE="${{ steps.config.outputs.title }}"
BASE_PATH=$(echo "$PAGES_URL" | sed 's|https\?://[^/]*||')
cat > config.js << EOF
window.bblocksRegister = '${PAGES_URL}build/register.json';
window.bblocksViewer = {
title: "${TITLE}",
showImported: 0,
baseUrl: '${BASE_PATH}',
};
EOF
cat > index.html << EOF
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="https://smrgeoinfo.github.io/bblocks-viewer/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>OGC Location Building Blocks</title>
<script src="${PAGES_URL}config.js"></script>
<script type="module" crossorigin src="https://smrgeoinfo.github.io/bblocks-viewer/assets/index.js"></script>
<link rel="stylesheet" href="https://smrgeoinfo.github.io/bblocks-viewer/assets/index.css">
</head>
<body>
<div id="app"></div>
</body>
</html>
EOF
cp index.html 404.html
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4