Skip to content

Commit

Permalink
chore: Add build and publish OpenAPI UI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheworris committed Jul 24, 2024
1 parent 0dbd4a9 commit 9956d84
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/common/openapi-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build and Publish OpenAPI UI

on:
workflow_call:
inputs:
service:
required: true
types: string

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
- uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm ci
working-directory: ./services/${{ inputs.service }}

- name: Generate Swagger Metadata
run: npm run build:metadata
working-directory: ./services/${{ inputs.service }}

- name: Generate Swagger JSON
run: npm run build:swagger
working-directory: ./services/${{ inputs.service }}

- name: Generate Swagger UI
run: npm run generate-swagger-ui
working-directory: ./services/${{ inputs.service }}

- name: Setup Pages
id: pages
uses: actions/configure-pages@v4

- name: Publish generated OpenAPI (index.html) to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/${{ inputs.service }}
19 changes: 19 additions & 0 deletions .github/workflows/deploy-gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ permissions:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
service:
- account
# - content-watcher
# - content-publishing
# - graph

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -38,6 +46,17 @@ jobs:
with:
path: ./docs/book

# Publish OpenAPI specs for each microservice
- name: Build and Publish OpenAPI spec for ${{ matrix.service }}
uses: ./.github/workflows/common/openapi-build.yml
with:
service: ${{ matrix.service }}

- name: Publish OpenAPI UI to GitHub Pages
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/${{ matrix.service }}

# Deployment job
deploy:
environment:
Expand Down

0 comments on commit 9956d84

Please sign in to comment.