Skip to content

Commit

Permalink
Create index.html in postprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
avillar committed Jul 31, 2023
1 parent 888e1d3 commit bb6832f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/validate-and-process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,30 @@ jobs:
uses: EndBug/add-and-commit@v9
with:
message: Building blocks postprocessing
- name: Create GH Pages index
if: ${{ github.event.repository.has_pages }}
shell: python
run: |
import json
with open('build/register.json') as f:
bblocks = json.load(f)
with open('index.html', 'w') as f:
f.write('<!doctype html><html><head><meta charset="utf-8"/><title>')
f.write('${{ github.repository }}')
f.write(' - Building Blocks</title></head><body><h1>')
f.write('${{ github.repository }}')
f.write('</h1><ul>')
for bblock in bblocks:
link = bblock.get('documentation', {}).get('slate', {})
name = bblock['name']
identifier = bblock['itemIdentifier']
if link:
f.write(f'<li><a href="{link}"><tt>{identifier}</tt> - {name}</a></li>')
else:
f.write(f'<li><tt>{identifier}</tt> - {name}</li>')
f.write('</ul></body></html>')
- name: Setup Pages
if: ${{ github.event.repository.has_pages }}
uses: actions/configure-pages@v3
Expand Down

0 comments on commit bb6832f

Please sign in to comment.