|
| 1 | +# Sample workflow for building and deploying a Jekyll site to GitHub Pages |
| 2 | +name: create widoco documentation |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_run: |
| 6 | + workflows: ["build"] |
| 7 | + types: |
| 8 | + - completed |
| 9 | + branches: ["main"] |
| 10 | + |
| 11 | + # Allows you to run this workflow manually from the Actions tab |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 15 | +permissions: |
| 16 | + contents: read |
| 17 | + pages: write |
| 18 | + id-token: write |
| 19 | + |
| 20 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 21 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 22 | +concurrency: |
| 23 | + group: "pages" |
| 24 | + cancel-in-progress: false |
| 25 | + |
| 26 | +jobs: |
| 27 | + # Check job |
| 28 | + check: |
| 29 | + runs-on: ubuntu-latest |
| 30 | + outputs: |
| 31 | + ontology-exists: ${{ steps.check.outputs.exists }} |
| 32 | + ontology-file: ${{ steps.check.outputs.file }} |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + - name: Check for ontology file |
| 37 | + id: check |
| 38 | + run: | |
| 39 | + ONTOLOGY_FILE=$(find src/ontology/ -name "*-full.owl" -type f | head -1) |
| 40 | + if [ -z "$ONTOLOGY_FILE" ]; then |
| 41 | + echo "No *-full.owl file found in src/ontology/ directory." |
| 42 | + echo "exists=false" >> $GITHUB_OUTPUT |
| 43 | + else |
| 44 | + echo "Found ontology file: $ONTOLOGY_FILE" |
| 45 | + echo "exists=true" >> $GITHUB_OUTPUT |
| 46 | + echo "file=$ONTOLOGY_FILE" >> $GITHUB_OUTPUT |
| 47 | + fi |
| 48 | +
|
| 49 | + # Build job |
| 50 | + build: |
| 51 | + runs-on: ubuntu-latest |
| 52 | + needs: check |
| 53 | + if: needs.check.outputs.ontology-exists == 'true' |
| 54 | + steps: |
| 55 | + - name: Checkout |
| 56 | + uses: actions/checkout@v4 |
| 57 | + - name: Setup Pages |
| 58 | + uses: actions/configure-pages@v5 |
| 59 | + - name: Build HTML for main |
| 60 | + run: | |
| 61 | + wget -O widoco.jar https://github.com/dgarijo/Widoco/releases/download/v1.4.25/widoco-1.4.25-jar-with-dependencies_JDK-11.jar |
| 62 | + mkdir ./_site |
| 63 | + java -jar widoco.jar -ontFile ${{ needs.check.outputs.ontology-file }} -outFolder ./_site -uniteSections -includeAnnotationProperties -lang en-de -getOntologyMetadata -noPlaceHolderText -rewriteAll -webVowl |
| 64 | + - name: add default entry point |
| 65 | + run: | |
| 66 | + cp ./_site/index-en.html ./_site/index.html |
| 67 | + - name: Upload artifact |
| 68 | + uses: actions/upload-pages-artifact@v3 |
| 69 | + |
| 70 | + # Deployment job |
| 71 | + deploy: |
| 72 | + environment: |
| 73 | + name: github-pages |
| 74 | + url: ${{ steps.deployment.outputs.page_url }} |
| 75 | + runs-on: ubuntu-latest |
| 76 | + needs: build |
| 77 | + steps: |
| 78 | + - name: Deploy to GitHub Pages |
| 79 | + id: deployment |
| 80 | + uses: actions/deploy-pages@v4 |
0 commit comments