Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add build and publish OpenAPI UI workflow #261

Conversation

mattheworris
Copy link
Contributor

@mattheworris mattheworris commented Jul 24, 2024

Problem

OpenAPI specs need to be published in the mono-repo.
Closes #260

Solution

  • Updated github workflows to publish the OpenAPI spec for each service

Steps to Verify:

  1. Verify that the docs are published correctly on github pages.
  2. The link tree: https://amplicalabs.github.io/gateway/
├── account
│   ├── index.html (OpenAPI spec)
├── content-watcher
│   ├── index.html (OpenAPI spec)
├── content-publishing
│   ├── index.html (OpenAPI spec)
├── graph
│   ├── index.html (OpenAPI spec)
├── index.html (mdbook)

@mattheworris mattheworris linked an issue Jul 24, 2024 that may be closed by this pull request
@mattheworris mattheworris self-assigned this Jul 24, 2024
@mattheworris mattheworris force-pushed the 260-setup-publishing-of-swagger-docs-compile-into-httpsgithubcomamplicalabsgatewayblobmaingithubworkflowsdeploy-gh-pagesyaml branch from bfb724a to 9cd1e78 Compare July 24, 2024 17:32
@mattheworris mattheworris force-pushed the 260-setup-publishing-of-swagger-docs-compile-into-httpsgithubcomamplicalabsgatewayblobmaingithubworkflowsdeploy-gh-pagesyaml branch from 1a85b7f to 9d54034 Compare July 24, 2024 19:03
@mattheworris mattheworris force-pushed the 260-setup-publishing-of-swagger-docs-compile-into-httpsgithubcomamplicalabsgatewayblobmaingithubworkflowsdeploy-gh-pagesyaml branch from 9d54034 to 9a6eac4 Compare July 24, 2024 19:19
@mattheworris mattheworris force-pushed the 260-setup-publishing-of-swagger-docs-compile-into-httpsgithubcomamplicalabsgatewayblobmaingithubworkflowsdeploy-gh-pagesyaml branch from 526859e to 7f9442d Compare July 24, 2024 21:32
@mattheworris mattheworris force-pushed the 260-setup-publishing-of-swagger-docs-compile-into-httpsgithubcomamplicalabsgatewayblobmaingithubworkflowsdeploy-gh-pagesyaml branch from 7f9442d to 4c0f580 Compare July 24, 2024 21:45
@mattheworris mattheworris force-pushed the 260-setup-publishing-of-swagger-docs-compile-into-httpsgithubcomamplicalabsgatewayblobmaingithubworkflowsdeploy-gh-pagesyaml branch from e13525c to 078ba20 Compare July 24, 2024 23:01
@mattheworris mattheworris force-pushed the 260-setup-publishing-of-swagger-docs-compile-into-httpsgithubcomamplicalabsgatewayblobmaingithubworkflowsdeploy-gh-pagesyaml branch from 078ba20 to ebd211b Compare July 24, 2024 23:03
@mattheworris mattheworris force-pushed the 260-setup-publishing-of-swagger-docs-compile-into-httpsgithubcomamplicalabsgatewayblobmaingithubworkflowsdeploy-gh-pagesyaml branch from 262f2fe to beb4325 Compare July 24, 2024 23:15
"build:swagger": "npx ts-node -r tsconfig-paths/register apps/api/src/build-openapi.ts",
"build:metadata": "npx ts-node apps/api/src/generate-metadata.ts",
"generate-swagger-ui": "npx --yes @redocly/cli build-docs swagger.json --output=./docs/index.html",
"build:swagger": "set -a ; . ./env.template ; npx ts-node -r tsconfig-paths/register apps/api/src/build-openapi.ts",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added env.template to each service openapi build because the build was failing without the environment variables.

Comment on lines +26 to +39
- name: Generate Swagger Metadata
run: npm run build:metadata
shell: bash
working-directory: ./services/${{ inputs.service }}

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

- name: Generate OpenAPI/Swagger UI
run: npm run generate-swagger-ui
shell: bash
working-directory: ./services/${{ inputs.service }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, I'm about to publish a PR standardizing on the following pattern for these targets:

generate:metadata
generate:openapi
generate:swagger-ui

Once this is merged, I'll pull into my PR & update the workflows.

@mattheworris mattheworris merged commit e3f4b72 into main Jul 25, 2024
19 checks passed
@mattheworris mattheworris deleted the 260-setup-publishing-of-swagger-docs-compile-into-httpsgithubcomamplicalabsgatewayblobmaingithubworkflowsdeploy-gh-pagesyaml branch July 25, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup publishing of Swagger docs
2 participants