Skip to content

Commit c7d5332

Browse files
authored
Redoc API 문서 생성 (#12)
GitHub Actions를 이용해 Redoc API 문서를 만들고 웹으로 배포. 각 프로젝트의 `README.md` 파일에 배포된 Redoc 문서 URL 추가. References: - https://github.com/Redocly/redoc - https://redocly.com/redoc
1 parent 6ebbe65 commit c7d5332

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

.github/workflows/build-and-deploy.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,33 @@ jobs:
1313
runs-on: ubuntu-latest
1414
permissions:
1515
contents: write
16-
if: github.ref == 'refs/heads/main'
1716
steps:
1817
- name: Checkout
1918
uses: actions/checkout@v4
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
- name: Install Redocly CLI
22+
run: npm install -g @redocly/cli@latest
2023
- name: Generate Swagger UI for Todo App
2124
uses: Legion2/swagger-ui-action@v1
2225
with:
2326
output: public/todo-app
2427
spec-file: ./todo-app/openapi.yaml
2528
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
- name: Generate Redoc API document for Todo App
30+
run: |
31+
redocly build-docs ./todo-app/openapi.yaml -o public/todo-app/redoc.html
2632
- name: Generate Swagger UI for Tickets API
2733
uses: Legion2/swagger-ui-action@v1
2834
with:
2935
output: public/tickets
3036
spec-file: ./tickets/openapi.yaml
3137
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Generate Redoc API document for Tickets API
39+
run: |
40+
redocly build-docs ./tickets/openapi.yaml -o public/tickets/redoc.html
3241
- name: Deploy to GitHub Pages
42+
if: github.ref == 'refs/heads/main'
3343
uses: peaceiris/actions-gh-pages@v3
3444
with:
3545
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public/

tickets/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22

33
Swagger UI:
44
<https://dal-lab.github.io/openapi-sample/tickets>
5+
6+
Redoc:
7+
<https://dal-lab.github.io/openapi-sample/tickets/redoc.html>

todo-app/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22

33
Swagger UI:
44
<https://dal-lab.github.io/openapi-sample/todo-app>
5+
6+
Redoc:
7+
<https://dal-lab.github.io/openapi-sample/todo-app/redoc.html>

0 commit comments

Comments
 (0)