Skip to content

Commit

Permalink
Merge pull request #31 from asam-ev/antora-setup
Browse files Browse the repository at this point in the history
Antora setup
  • Loading branch information
ClemensLinnhoff authored Jul 5, 2024
2 parents 9ab8f0c + 4bb650e commit 78fa3c9
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 22 deletions.
60 changes: 38 additions & 22 deletions .github/workflows/antora-build.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,43 @@
name: Antora Documentation Build
# Based on https://github.com/OpenSimulationInterface/osi-documentation/blob/master/.github/workflows/antora-build.yml
# 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 ]
pull_request:
branches: [ main ]

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:
trigger_antora:
name: Trigger antora generator

runs-on: Ubuntu-latest

env:
MUP_KEY: ${{ secrets.MACHINE_USER_PAT }}

build:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Trigger generator
if: ${{ env.MUP_KEY != '' }}
uses: peter-evans/repository-dispatch@v3
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure Pages
uses: actions/configure-pages@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
token: ${{ secrets.MACHINE_USER_PAT }}
event-type: antora-build-trigger
repository: # Add fork of https://code.asam.net/common/templates/antora-base-repo-example
client-payload: '{"src": "${{ github.repository }}", "ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "head_ref": "${{ github.head_ref }}"}'

node-version: '20'
- name: Install Antora
run: npm i antora
- name: Generate Site
run: npx antora antora-playbook.yml
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v3
with:
path: build/site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
36 changes: 36 additions & 0 deletions antora-playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Minimal configuration based on Antora Generator Template
# Source: https://code.asam.net/common/templates/antora-base-repo-example/-/blob/standard_generator/site.yml
# tag::site[]
site:
title: ASAM OpenMATERIAL
url: https://asam-ev.github.io/OpenMATERIAL/
start_page: asamopenmaterial:specification:index.adoc
# end::site[]
urls: # Creates a redirect for the newest version to the link "latest"
latest_version_segment_strategy: redirect:to
latest_version_segment: latest

# tag::content[]
content:
sources:
- url: https://github.com/asam-ev/OpenMATERIAL.git
branches: [main, v*.*.*]
tags: [v*,V*]
start_path: .antora
- url: https://code.asam.net/common/asam-terminology.git
start_path: .antora
tags: [v*,V*]
# end::content[]

ui:
bundle:
url: https://code.asam.net/common/antora-ui/-/jobs/artifacts/main/raw/build/ui-bundle.zip?job=bundle-stable
snapshot: true
# supplemental_files: ./supplemental_ui # Activate this if you need to make local UI changes. Check the official Antora documentation for more information.

output:
clean: true
dir: ./build/site

runtime:
fetch: true

0 comments on commit 78fa3c9

Please sign in to comment.