From 1c42bc33ea7ab79f1a1edb1c7b384b792382bb8b Mon Sep 17 00:00:00 2001 From: Alejandro Villar Date: Thu, 21 Mar 2024 11:34:39 +0100 Subject: [PATCH] Use remote viewer --- .github/workflows/validate-and-process.yml | 53 ++++++++++------------ 1 file changed, 23 insertions(+), 30 deletions(-) diff --git a/.github/workflows/validate-and-process.yml b/.github/workflows/validate-and-process.yml index a4bd41f..987b236 100644 --- a/.github/workflows/validate-and-process.yml +++ b/.github/workflows/validate-and-process.yml @@ -139,33 +139,6 @@ jobs: run: | sudo find "${{ inputs.annotated_path }}" -name _visited_properties.tsv -delete sudo find "${{ inputs.annotated_path }}" -name _visited_properties.tsv.gz -delete - - name: Create GH Pages index - if: ${{ !inputs.deploy_viewer && github.event.repository.has_pages && !inputs.skip-pages }} - shell: python - run: | - import json - - with open('${{ inputs.register_file }}') as f: - bblocks = json.load(f) - if isinstance(bblocks, dict): - bblocks = bblocks.get('bblocks', ()) - - with open('index.html', 'w') as f: - f.write('') - f.write('${{ github.repository }}') - f.write(' - Building Blocks

') - f.write('${{ github.repository }}') - f.write('

Validation report

') - name: Deploy Building Blocks viewer if: ${{ inputs.deploy_viewer && github.event.repository.has_pages && !inputs.skip-pages }} run: | @@ -184,25 +157,45 @@ jobs: else BASE_URL=${BASE_URL#./} fi - wget -q -O - https://github.com/ogcincubator/bblocks-viewer/archive/refs/heads/dist.tar.gz | tar zx --strip-components=1 - sed -i -r "s,/@BASE_URL@/,/${{ github.event.repository.name }}/${BASE_URL},g" index.html 404.html assets/*.js assets/*.css + + cat << EOF > index.html + + + + + + + OGC Location Building Blocks + + + + + +
+ + + EOF + cat << EOF > config.js window.bblocksRegister = '${{ format('https://{0}.github.io/{1}/{2}', github.repository_owner, github.event.repository.name, inputs.register_file) }}'; window.bblocksViewer = { title: $(jq '.name // "${{ github.event.repository.name }}"' < "$REGISTER_FILE"), showImported: ${{ inputs.viewer_show_imported }}, + baseUrl: '/${{ github.event.repository.name }}/${BASE_URL}/', }; EOF + if [ -f GIT_INFO ]; then TEMPFILE="$(mktemp)" jq -s '.[0].tooling."bblocks-viewer" = .[1] | .[0]' "$REGISTER_FILE" GIT_INFO > "$TEMPFILE" mv "$TEMPFILE" "$REGISTER_FILE" rm -f "$TEMPFILE" fi + cd "$OLD_WD" if [ ! -f "404.html" ]; then - cp "${{ inputs.viewer_path }}/404.html" . + cp "${{ inputs.viewer_path }}/index.html" 404.html fi - name: Setup Pages if: ${{ github.event.repository.has_pages && !inputs.skip-pages }}