Deploy to GitHub Pages #17
Workflow file for this run
This file contains hidden or 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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- docs/** | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
service: | |
- account | |
# - content-watcher | |
# - content-publishing | |
# - graph | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up mdBook 📚 | |
if: matrix.service == 'account' # Only upload mdbook once | |
uses: ./.github/workflows/common/set-up-mdbook | |
with: | |
token: ${{secrets.GITHUB_TOKEN}} | |
- name: Setup Pages | |
if: matrix.service == 'account' # Only setup Pages once | |
id: pages | |
uses: actions/configure-pages@v4 | |
- name: Build with mdBook | |
if: matrix.service == 'account' # Only build mdbook once | |
working-directory: docs | |
run: mdbook build && ls book | |
# Upload the mdBook output to GitHub Pages | |
- name: Upload mdbook to GitHub Pages | |
if: matrix.service == 'account' # Only upload mdbook once | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mdbook | |
path: ./docs/book | |
# Publish OpenAPI specs for each microservice | |
- name: Build and Publish OpenAPI spec for ${{ matrix.service }} | |
uses: ./.github/workflows/common/openapi-build | |
with: | |
service: ${{ matrix.service }} | |
- name: Upload OpenAPI UI to GitHub Pages | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
name: openapi-${{ matrix.service }} | |
path: ./docs/${{ matrix.service }} | |
# Deployment job | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download mdbook artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: mdbook | |
path: ./docs/book | |
- name: Download account OpenAPI artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: openapi-account | |
path: ./docs/account | |
- name: Download content-watcher OpenAPI artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: openapi-content-watcher | |
path: ./docs/content-watcher | |
- name: Download content-publishing OpenAPI artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: openapi-content-publishing | |
path: ./docs/content-publishing | |
- name: Download graph OpenAPI artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: openapi-graph | |
path: ./docs/graph | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |