-
Notifications
You must be signed in to change notification settings - Fork 69
60 lines (50 loc) · 1.51 KB
/
swagger-publish.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
57
58
59
60
name: Publish spec version to SwaggerHub
on:
push:
branches:
- master
- release/[0-9]+.[0-9]+.[0-9]+
jobs:
validate-spec:
name: Validate spec file
runs-on: ubuntu-22.04
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache-dependency-path: go.sum
- run: make install-swag
- uses: actions/setup-node@v4
with:
node-version: '20.17.0'
- run: npm install --location=global @openapitools/openapi-generator-cli
- run: make spec
- run: make validate-spec
- name: Save build artifact
uses: actions/upload-artifact@v3
with:
name: specfile
path: docs/swagger.yaml
publishspec:
name: Upload generated OpenAPI description
runs-on: ubuntu-22.04
needs: validate-spec
defaults:
run:
working-directory: .
steps:
- uses: actions/checkout@v4
- name: Download spec file artifact
uses: actions/[email protected]
with:
name: specfile
path: docs
- uses: actions/setup-node@v3
- run: npm i --location=global swaggerhub-cli
- run: |
VERSION=`echo ${GITHUB_REF_NAME}| sed 's#[^a-zA-Z0-9_\.\-]#_#g'`
SWAGGERHUB_API_KEY=${{secrets.SWAGGERHUB_TOKEN}} swaggerhub api:create "Moira/moira-alert/${VERSION}" -f ./docs/swagger.yaml --published=publish --visibility=public