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 }}