@@ -139,33 +139,6 @@ jobs:
139
139
run : |
140
140
sudo find "${{ inputs.annotated_path }}" -name _visited_properties.tsv -delete
141
141
sudo find "${{ inputs.annotated_path }}" -name _visited_properties.tsv.gz -delete
142
- - name : Create GH Pages index
143
- if : ${{ !inputs.deploy_viewer && github.event.repository.has_pages && !inputs.skip-pages }}
144
- shell : python
145
- run : |
146
- import json
147
-
148
- with open('${{ inputs.register_file }}') as f:
149
- bblocks = json.load(f)
150
- if isinstance(bblocks, dict):
151
- bblocks = bblocks.get('bblocks', ())
152
-
153
- with open('index.html', 'w') as f:
154
- f.write('<!doctype html><html><head><meta charset="utf-8"/><title>')
155
- f.write('${{ github.repository }}')
156
- f.write(' - Building Blocks</title><style>.validation-failed::before{color:red;content:"❌ "}.validation-passed::before{color:green;content:"✅️ "}</style></head><body><h1>')
157
- f.write('${{ github.repository }}')
158
- f.write('</h1><ul>')
159
- for bblock in sorted(bblocks, key=lambda x: x['itemIdentifier']):
160
- link = bblock.get('documentation', {}).get('slate', {}).get('url')
161
- name = bblock['name']
162
- identifier = bblock['itemIdentifier']
163
- validation = 'passed' if bblock.get('validationPassed', True) else 'failed'
164
- if link:
165
- f.write(f'<li class="validation-{validation}"><a href="{link}"><tt>{identifier}</tt> - {name}</a></li>')
166
- else:
167
- f.write(f'<li class="validation-{validation}"><tt>{identifier}</tt> - {name}</li>')
168
- f.write('</ul><p style="margin-top:1em"><a href="${{ inputs.test_outputs_path }}/report.html">Validation report</a></p></body></html>')
169
142
- name : Deploy Building Blocks viewer
170
143
if : ${{ inputs.deploy_viewer && github.event.repository.has_pages && !inputs.skip-pages }}
171
144
run : |
@@ -184,25 +157,45 @@ jobs:
184
157
else
185
158
BASE_URL=${BASE_URL#./}
186
159
fi
187
- wget -q -O - https://github.com/ogcincubator/bblocks-viewer/archive/refs/heads/dist.tar.gz | tar zx --strip-components=1
188
- sed -i -r "s,/@BASE_URL@/,/${{ github.event.repository.name }}/${BASE_URL},g" index.html 404.html assets/*.js assets/*.css
160
+
161
+ cat << EOF > index.html
162
+ <!DOCTYPE html>
163
+ <html lang="en">
164
+ <head>
165
+ <meta charset="UTF-8" />
166
+ <link rel="icon" href="https://ogcincubator.github.io/bblocks-viewer/favicon.ico" />
167
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
168
+ <title>OGC Location Building Blocks</title>
169
+ <script src="/${{ github.event.repository.name }}/${BASE_URL}/config.js"></script>
170
+ <script type="module" crossorigin src="https://ogcincubator.github.io/bblocks-viewer/assets/index.js"></script>
171
+ <link rel="stylesheet" href="https://ogcincubator.github.io/bblocks-viewer/assets/index.css">
172
+ </head>
173
+ <body>
174
+ <div id="app"></div>
175
+ </body>
176
+ </html>
177
+ EOF
178
+
189
179
cat << EOF > config.js
190
180
window.bblocksRegister = '${{ format('https://{0}.github.io/{1}/{2}', github.repository_owner, github.event.repository.name, inputs.register_file) }}';
191
181
window.bblocksViewer = {
192
182
title: $(jq '.name // "${{ github.event.repository.name }}"' < "$REGISTER_FILE"),
193
183
showImported: ${{ inputs.viewer_show_imported }},
184
+ baseUrl: '/${{ github.event.repository.name }}/${BASE_URL}/',
194
185
};
195
186
EOF
187
+
196
188
if [ -f GIT_INFO ]; then
197
189
TEMPFILE="$(mktemp)"
198
190
jq -s '.[0].tooling."bblocks-viewer" = .[1] | .[0]' "$REGISTER_FILE" GIT_INFO > "$TEMPFILE"
199
191
mv "$TEMPFILE" "$REGISTER_FILE"
200
192
rm -f "$TEMPFILE"
201
193
fi
194
+
202
195
cd "$OLD_WD"
203
196
204
197
if [ ! -f "404.html" ]; then
205
- cp "${{ inputs.viewer_path }}/404 .html" .
198
+ cp "${{ inputs.viewer_path }}/index .html" 404.html
206
199
fi
207
200
- name : Setup Pages
208
201
if : ${{ github.event.repository.has_pages && !inputs.skip-pages }}
0 commit comments