-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (83 loc) · 2.47 KB
/
render.yml
File metadata and controls
99 lines (83 loc) · 2.47 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: OpenAPI render
on:
push:
branches: [ openapi ]
pull_request:
branches: [ openapi ]
workflow_dispatch:
env:
openapi_dir: ./restapi/
bundle: ./restapi/openapi_full.yaml
render_dir: ./swagger-ui/
artifact-bundle: openapi-bundle
artifact-render: openapi-render
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create OpenAPI bundle (combine multiple files)
uses: mpetrunic/swagger-cli-action@v1.0.0
with:
command: "bundle --outfile ${{ env.bundle }} --type yaml ./restapi/openapi.yaml"
- name: Upload OpenAPI bundle artifact
uses: actions/upload-artifact@v2.2.2
with:
name: ${{ env.artifact-bundle }}
path: ${{ env.bundle }}
if-no-files-found: error
validate:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download OpenAPI bundle artifact
uses: actions/download-artifact@v2.0.8
with:
name: ${{ env.artifact-bundle }}
path: ${{ env.openapi_dir }}
- name: Validate OpenAPI bundle
uses: mbowman100/swagger-validator-action@2.0
with:
files: ${{ env.bundle }}
build:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download OpenAPI bundle artifact
uses: actions/download-artifact@v2.0.8
with:
name: ${{ env.artifact-bundle }}
path: ${{ env.openapi_dir }}
- name: Generate Swagger UI
uses: Legion2/swagger-ui-action@v1
with:
output: ${{ env.render_dir }}
spec-file: ${{ env.bundle }}
- name: Upload OpenAPI render artifact
uses: actions/upload-artifact@v2.2.2
with:
name: ${{ env.artifact-render }}
path: ${{ env.render_dir }}
if-no-files-found: error
publish:
needs: [ validate, build ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download OpenAPI bundle artifact
uses: actions/download-artifact@v2.0.8
with:
name: ${{ env.artifact-render }}
path: ${{ env.render_dir }}
- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@v2
with:
build_dir: ${{ env.render_dir }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}