1- # name: Build ontology docs
1+ name : SHACL Documentation Generation
22
3- # on:
4- # workflow_call:
3+ on :
4+ push :
5+ paths :
6+ - ' build/ontology/**'
7+ pull_request :
8+ paths :
9+ - ' build/ontology/**'
510
6- # jobs:
11+ jobs :
12+ generate-docs :
13+ runs-on : ubuntu-latest
714
8- # build:
9- # runs-on: ubuntu-latest
15+ steps :
16+ - name : Checkout repository
17+ uses : actions/checkout@v4
1018
11- # steps:
19+ - name : Set up Python and install dependencies
20+ run : |
21+ python -m pip install --upgrade pip
22+ pip install rdflib
1223
13- # - uses: actions/checkout@v4
24+ - name : Enrich ontology with rdflib
25+ id : enrich
26+ run : |
27+ python tools/python/docs/sparql.py
28+ echo "enriched_file=/tmp/enriched.ttl" >> $GITHUB_ENV
29+
1430
15- # - name: Set up Python
16- # uses: actions/setup-python@v5
17- # with:
18- # python-version: '3.12'
31+ - name : Set up Java 11
32+ uses : actions/setup-java@v4
33+ with :
34+ distribution : ' temurin'
35+ java-version : ' 11'
1936
20- # - name: Install dependencies
21- # run: |
22- # python -m pip install --upgrade pip
23- # pip install
37+ - name : Install Graphviz
38+ run : |
39+ sudo apt-get update
40+ sudo apt-get install -y graphviz
2441
25- # TODO: BUILD DOCUMENTATION USING RESPECTER
42+ - name : Set DOT_PATH environment variable
43+ run : echo "GRAPHVIZ_DOT=/usr/bin/dot" >> $GITHUB_ENV
44+
45+ - name : Download SHACL Play CLI
46+ run : |
47+ wget https://github.com/sparna-git/shacl-play/releases/download/0.10.2/shacl-play-app-0.10.2-onejar.jar -O shacl-play-cli.jar
48+
49+ - name : Generate Documentation
50+ run : |
51+ java -jar shacl-play-cli.jar \
52+ doc \
53+ -d \
54+ -i ${{ env.enriched_file }} \
55+ -l en \
56+ -o docs/index.html
57+
58+ - name : Generate Ontology Diagram
59+ run : |
60+ java -jar shacl-play-cli.jar \
61+ draw \
62+ -i ${{ env.enriched_file }} \
63+ -o docs/ontology.svg
64+
65+ - name : Commit generated docs
66+ run : |
67+ git config user.name "github-actions[bot]"
68+ git config user.email "github-actions[bot]@users.noreply.github.com"
69+ git add docs/index.html
70+ git add docs/ontology.svg
71+ git commit -m "Update generated docs" || echo "Nothing to commit"
72+ git push
73+
74+ - name : Upload generated documentation as an artifact
75+ uses : actions/upload-artifact@v4
76+ with :
77+ name : shacl-documentation
78+ path : docs/index.html
0 commit comments