diff --git a/.github/workflows/deploy-api-docs.yml b/.github/workflows/deploy-api-docs.yml new file mode 100644 index 000000000..41db36585 --- /dev/null +++ b/.github/workflows/deploy-api-docs.yml @@ -0,0 +1,42 @@ +name: Deploy OpenAPI Documentation to GitHub Pages + +on: + workflow_dispatch: + push: + branches: + - 'main' + paths: + - 'openapi.yml' + +jobs: + upload-openapi-spec: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Upload openapi.yml + uses: actions/upload-artifact@v2 + with: + name: spec-file + path: openapi.yml + generate-openapi-ui: + name: Generate Swagger UI and Deploy to Pages + needs: upload-openapi-spec + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Download openapi.yml + uses: actions/download-artifact@v2 + with: + name: spec-file + + - name: Generate Swagger UI + uses: Legion2/swagger-ui-action@v1 + with: + output: api-docs + spec-file: openapi.yml + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: api-docs diff --git a/.github/workflows/lint-api-docs.yml b/.github/workflows/lint-api-docs.yml new file mode 100644 index 000000000..976505f93 --- /dev/null +++ b/.github/workflows/lint-api-docs.yml @@ -0,0 +1,26 @@ +name: Lint OpenAPI Spec + +on: + workflow_dispatch: + pull_request: + paths: + - 'openapi.yml' + - docs/api_docs/ + +jobs: + lint-spec: + runs-on: ubuntu-latest + name: Lint OpenAPI Spec + steps: + - uses: mshick/add-pr-comment@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + message: | + Looks like you've updated the OpenAPI spec! Make sure to: + - check the output of the `Lint OpenAPI Spec` action + - run `script/lint-and-bundle-openapi-schema.sh` and commit any resulting changes. + - uses: actions/checkout@v2 + - name: Lint OpenAPI Spec + uses: trybeapp/redocly-openapi-cli-github-action@v0.0.1 + with: + args: 'lint openapi.yml --extends=minimal --skip-rule=no-empty-servers' diff --git a/README.md b/README.md index 0916cdf8e..31daca580 100644 --- a/README.md +++ b/README.md @@ -104,3 +104,4 @@ Make sure to lint and bundle the API schema locally by running `script/lint-and- You can also explore the components of an OpenAPI spec [using this map](http://openapi-map.apihandyman.io/) +The UI spec is viewable [here](tbd)