Skip to content

Commit c24ca73

Browse files
katexochenm1ghtym0
andauthored
Set up OpenAPI workflow (#230)
* Set up OpenAPI workflow * Update Swagger specification Co-authored-by: m1ghtym0 <[email protected]>
1 parent 79533ce commit c24ca73

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

.github/workflows/openapi-make.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Create and validate OpenAPI specification
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
make-openapi-spec:
7+
runs-on: ubuntu-18.04
8+
container:
9+
image: ghcr.io/edgelesssys/edgelessrt-dev:ci
10+
11+
steps:
12+
- name: Install jq
13+
run: apt install -y jq
14+
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
18+
- name: Create download URL
19+
run: echo "download_url=$(curl -s https://api.github.com/repos/go-swagger/go-swagger/releases/latest | jq -r '.assets[] | select(.name | contains("'"$(uname | tr '[:upper:]' '[:lower:]')"'_amd64")) | .browser_download_url')" >> $GITHUB_ENV
20+
21+
- name: Download go-swagger
22+
run: curl -o /usr/local/bin/swagger -L'#' ${{ env.download_url }}
23+
24+
- name: Make file executable
25+
run: chmod +x /usr/local/bin/swagger
26+
27+
- name: Check version
28+
run: swagger version
29+
30+
- name: Generate Swagger file from annotations
31+
run: swagger generate spec -m --compact --exclude-deps -o ./swagger.json
32+
env:
33+
SWAGGER_GENERATE_EXTENSION: false
34+
35+
- name: Validate Swagger
36+
run: swagger validate ./swagger.json
37+
38+
- name: commit swagger.json
39+
uses: stefanzweifel/git-auto-commit-action@v4
40+
with:
41+
commit_message: Update Swagger specification
42+
file_pattern: swagger.json
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish OpenAPI specification to documentation
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths:
7+
- 'swagger.json'
8+
jobs:
9+
publish-to-docs:
10+
runs-on: ubuntu-18.04
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- name: Publish file to documentation
16+
uses: andstor/copycat-action@v3
17+
with:
18+
personal_token: ${{ secrets.CI_GITHUB_REPOSITORY }}
19+
src_path: swagger.json
20+
dst_owner: edgelesssys
21+
dst_repo_name: docs.edgeless.systems
22+
dst_branch: action/marblerun/update-swagger
23+
dst_path: marblerun/_media/swagger.json
24+
commit_message: OpenAPI spec of MarbleRun was updated

0 commit comments

Comments
 (0)