-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (47 loc) · 1.45 KB
/
deploy_openapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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