-
Notifications
You must be signed in to change notification settings - Fork 16
68 lines (60 loc) · 1.84 KB
/
update-openapi-doc.yaml
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
name: Update OpenAPI doc
on:
push:
branches:
- main
tags:
- 'v*'
env:
GHPAGES_DIR: gh-pages
GHPAGES_REF: refs/heads/gh-pages
jobs:
update-version:
name: Update API versions list and specs
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.16.8
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout github pages
uses: actions/checkout@v2
with:
ref: ${{ env.GHPAGES_REF }}
path: ${{ env.GHPAGES_DIR }}
- name: Generate specs
run: |
make install-swag
export PATH=$(go env GOPATH)/bin:$PATH
swag --version
make gen-swagger
- name: Install dependencies
run: |
cd ./.github/actions/update-api-doc
npm ci
- name: Update version list and copy spec files
uses: ./.github/actions/update-api-doc
with:
specs-source: ./public/docs/swagger.json
gh-pages-branch: ${{ env.GHPAGES_DIR }}
- name: Log generated changes
run: |
echo "::group::gh-pages dist dir"
ls -la ${{ env.GHPAGES_DIR }}
echo "::endgroup::"
echo "::group::versions.json"
cat ${{ env.GHPAGES_DIR }}/versions.json
echo "::endgroup::"
echo "::group::yaml-spec"
cat ${{ env.GHPAGES_DIR }}/key-manager-api.latest.json
echo "::endgroup::"
- name: Deploy changes to gh-pages
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: ${{ env.GHPAGES_DIR }} # The branch the action should deploy to.
FOLDER: ${{ env.GHPAGES_DIR }} # The folder the action should deploy.
CLEAN: false
PRESERVE: true