Skip to content

Commit

Permalink
split workflows out
Browse files Browse the repository at this point in the history
  • Loading branch information
therzka committed Feb 10, 2023
1 parent e3f32cf commit 70f3c89
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/deploy-api-docs.yml
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions .github/workflows/lint-api-docs.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
with:
args: 'lint openapi.yml --extends=minimal --skip-rule=no-empty-servers'
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 70f3c89

Please sign in to comment.