Skip to content

chore: move checkout to composite action and use global ref #2

chore: move checkout to composite action and use global ref

chore: move checkout to composite action and use global ref #2

name: Example n5geh data model workflow
description: |
This workflow generates Swagger UI for API specs of data models and deploys them to GitHub Pages.
It uses preconfigured composite actions to setup and then generate the Swagger UI and ultimately deploy the site.
env:
JSON_SCHEMA_PATH: example_building_automation/schemas
OUTPUT_ROOT_PATH: example_building_automation/deploy
API_DOCS_PATH: example_building_automation/api_docs
on:
push:
# Adjust branches as needed
branches:
- main
jobs:
set-matrix:
runs-on: ubuntu-latest
concurrency:
group: data-models-set-matrix
cancel-in-progress: false
outputs:
matrix: ${{ steps.build_matrix.outputs.matrix }}
steps:
- name: Build matrix from API docs
id: build_matrix
# uses: ./.github/actions/find-openapi-spec
uses: N5GEH/n5geh.data_models/.github/actions/find-openapi-spec@main
with:
API_DOCS_PATH: ${{ env.API_DOCS_PATH }}
generate-swagger-ui:
needs: set-matrix
runs-on: ubuntu-latest
strategy:
# Use the dynamically generated matrix.
# Each job will process one API spec file.
matrix:
include: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
steps:
- name: Generate Swagger UI using composite action
# uses: ./.github/actions/generate-swagger-ui
uses: N5GEH/n5geh.data_models/.github/actions/generate-swagger-ui@main
with:
spec: ${{ matrix.spec }}
base: ${{ matrix.base }}
output: ${{ matrix.output }}
JSON_SCHEMA_PATH: ${{ env.JSON_SCHEMA_PATH }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
deploy-gh-pages:
runs-on: ubuntu-latest
needs: generate-swagger-ui
steps:
- name: Deploy the site via composite action
# uses: ./.github/actions/deploy-gh-pages
uses: N5GEH/n5geh.data_models/.github/actions/deploy-gh-pages@main
with:
OUTPUT_ROOT_PATH: ${{ env.OUTPUT_ROOT_PATH }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}