Skip to content

Commit

Permalink
Merge pull request #42 from Progaku-copy/#36_deploy/open-api-on-gh-pages
Browse files Browse the repository at this point in the history
#36 deploy/open api on gh pages
  • Loading branch information
yuta-tokuda authored Jun 13, 2024
2 parents 114a9cb + b3b8f59 commit ff3ed4c
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/deploy_openapi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Deploy Swagger UI to Page
on:
pull_request:
paths:
- backend/doc/**
- .github/workflows/deploy_openapi.yml
workflow_dispatch:

jobs:
swagger-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install swagger-cli
run: npm install -g swagger-cli

- name: Validate swagger files
run: swagger-cli validate -d ./backend/doc/openapi.yml --type yaml --format 3

swagger-release:
needs: swagger-validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Create deploy directory
run: mkdir -p docs/swagger

- name: Copy OpenAPI file
run: cp -r backend/doc/* docs/swagger/

- name: Copy Swagger static files
run: |
wget https://github.com/swagger-api/swagger-ui/archive/refs/tags/v5.11.8.tar.gz
tar -zxvf v5.11.8.tar.gz
cp -r swagger-ui-5.11.8/dist/* docs/swagger/
sed -i 's|https://petstore.swagger.io/v2/swagger.json|./openapi.yml|' docs/swagger/swagger-initializer.js
- name: Upload artifact for deployment
uses: actions/upload-pages-artifact@v1
with:
path: docs/swagger

deploy:
needs: swagger-release
permissions:
pages: write
id-token: write
environment:
name: github-pages
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
9 changes: 9 additions & 0 deletions backend/doc/paths/memoId.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ paths:
- name: memoId
in: path
required: true
schema:
type: integer
format: int64
responses:
'200':
description: OK
Expand Down Expand Up @@ -36,6 +39,9 @@ paths:
- name: memoId
in: path
required: true
schema:
type: integer
format: int64
requestBody:
required: true
content:
Expand Down Expand Up @@ -67,6 +73,9 @@ paths:
- name: memoId
in: path
required: true
schema:
type: integer
format: int64
responses:
'204':
description: No Content
Expand Down

0 comments on commit ff3ed4c

Please sign in to comment.