From 9dace03d5e8a842caad06e423a26071cd839052f Mon Sep 17 00:00:00 2001 From: Jennings Zhang Date: Mon, 7 Oct 2024 19:14:03 -0400 Subject: [PATCH] Deploy OpenAPI html2 documentation to GitHub Pages --- .github/workflows/ci.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06a991c7..6c80157f 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -115,6 +115,47 @@ jobs: - name: Stop services run: just down + build-docs: + name: Generate OpenAPI Documentation + if: startsWith(github.ref, 'refs/tags/v') + needs: openapi + runs-on: ubuntu-24.04 + steps: + - uses: actions/download-artifact@v4 + with: + name: openapi_schema + - name: Install the OpenAPI Generator + run: npm install @openapitools/openapi-generator-cli -g + - name: Generate html2 + run: | + openapi-generator-cli generate -i schema_split.yaml -g html2 -o dist \ + -p infoEmail=dev@babymri.org,infoUrl=https://chrisproject.org \ + -p licenseInfo=MIT \ + -p licenseUrl=${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/LICENSE \ + -p pythonPackageName=chris_oag + - name: Upload pages artifact + with: + path: ./dist + + deploy-docs: + name: Update GitHub Pages + needs: build-docs + runs-on: ubuntu-24.04 + + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment + permissions: + pages: write # to deploy to Pages + id-token: write # to verify the deployment originates from an appropriate source + # Deploy to the github-pages environment + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + draft-release: name: Draft GitHub Release runs-on: ubuntu-24.04