Merge pull request #114 from asam-ev/add_asam-antora-extensions #57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Minimal working Antora configuration to publish to GitHub Pages | |
# Source: https://docs.antora.org/antora/latest/publish-to-github-pages/ (example 2) | |
# Output URL: https://asam-ev.github.io/OpenMATERIAL | |
name: Publish with Antora to GitHub Pages | |
on: | |
push: | |
branches: [main] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
concurrency: | |
group: github-pages | |
cancel-in-progress: false | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
name: Build OpenMATERIAL documentation and deploy it to gh-pages | |
runs-on: ubuntu-latest | |
services: | |
kroki: | |
image: yuzutech/kroki:0.15.1 | |
env: | |
KROKI_MAX_URI_LENGTH: 8000 | |
KROKI_BLOCKDIAG_HOST: blockdiag | |
KROKI_MERMAID_HOST: mermaid | |
blockdiag: | |
image: yuzutech/kroki-blockdiag:0.15.1 | |
mermaid: | |
image: yuzutech/kroki-mermaid:0.15.1 | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout with submodules | |
uses: actions/checkout@v4 | |
with: | |
path: repo | |
fetch-depth: 0 # test if depth in fetch history is required | |
submodules: recursive | |
- name: Checkout documentation | |
if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref }} | |
uses: actions/checkout@v4 | |
with: | |
repository: asam-ev/OpenMATERIAL | |
path: repo #osi-documentation | |
fetch-depth: 0 # test if depth in fetch history is required | |
- name: Apply dispatch information | |
if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.head_ref }} | |
working-directory: repo | |
run: | | |
SRC=${{ github.event.client_payload.src }} | |
IFS="/" | |
SRC_REPO=($SRC) | |
unset IFS | |
SRC_REPO=${SRC_REPO[1]} | |
HEAD_REF=${{ github.event.client_payload.head_ref }} | |
echo Branch build for ${HEAD_REF} in ${SRC_REPO} | |
sed -i -r "s|\[(.*)\] # o|[\1,HEAD] # ${SRC_REPO} # o|g" site.yml | |
sed -i -r "s|(- url: .*# retrieve content from remote)|# \1|g" site.yml | |
sed -i -r "s|# (- url: .*# retrieve content locally)|\1|g" site.yml | |
echo Checking out the target branch | |
cd OpenMATERIAL | |
git checkout ${HEAD_REF} 2>/dev/null || git checkout -b ${HEAD_REF} | |
cd .. | |
- name: Generate AsciiDoc from JSON | |
working-directory: repo/scripts | |
run: | | |
python3 json2asciidoc.py ../schemas/asset_schema.json metadata | |
mv metadata.adoc ../content/geometry/ | |
python3 json2asciidoc.py ../schemas/material_schema.json metadata | |
mv metadata.adoc ../content/material/ | |
python3 json2asciidoc.py ../schemas/material_schema.json material_properties | |
mv material_properties.adoc ../content/material/material-properties.adoc | |
python3 json2asciidoc.py ../schemas/material_emp_schema.json electromagnetic_properties | |
mv electromagnetic_properties.adoc ../content/material/electromagnetic-properties.adoc | |
- name: Configure Pages | |
uses: actions/configure-pages@v4 | |
- name: Generate site | |
uses: docker://ghcr.io/asam-ev/project-guide-docker:4 | |
with: | |
entrypoint: sh | |
args: repo/run-build.sh # modfied based on OSI | |
- name: Upload Artifacts | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: ./repo/site | |
deploy: | |
# Run if it was not triggered from remote OR the remote source was master or main. | |
if: ${{ github.event_name != 'repository_dispatch' || contains(github.event.client_payload.ref, 'master') || contains(github.event.client_payload.ref, 'main') }} | |
# Allow one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
needs: build | |
permissions: | |
actions: read | |
pages: write | |
id-token: write | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy | |
id: deployment | |
uses: actions/deploy-pages@v4 | |