Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/openapi-make.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Create and validate OpenAPI specification
on:
pull_request:

jobs:
make-openapi-spec:
runs-on: ubuntu-18.04
container:
image: ghcr.io/edgelesssys/edgelessrt-dev:ci

steps:
- name: Install jq
run: apt install -y jq

- name: Checkout
uses: actions/checkout@v2

- name: Create download URL
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

- name: Download go-swagger
run: curl -o /usr/local/bin/swagger -L'#' ${{ env.download_url }}

- name: Make file executable
run: chmod +x /usr/local/bin/swagger

- name: Check version
run: swagger version

- name: Generate Swagger file from annotations
run: swagger generate spec -m --compact --exclude-deps -o ./swagger.json
env:
SWAGGER_GENERATE_EXTENSION: false

- name: Validate Swagger
run: swagger validate ./swagger.json

- name: commit swagger.json
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Apply swagger.json changes
file_pattern: swagger.json
27 changes: 27 additions & 0 deletions .github/workflows/openapi-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish OpenAPI specification to documentation
on:
push:
branches:
- master
paths:
- 'swagger.json'
jobs:
publish-to-docs:
needs: make-openapi-spec
runs-on: ubuntu-18.04
steps:
- name: Download swagger.json
uses: actions/download-artifact@v2
with:
name: swagger.json
path: swagger.json
- name: Publish file to documentation
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.CI_GITHUB_REPOSITORY }}
src_path: swagger.json
dst_owner: edgelesssys
dst_repo_name: docs.edgeless.systems
dst_branch: action/marblerun/update-swagger
dst_path: marblerun/_media/swagger.json
commit_message: OpenAPI spec of MarbleRun was updated
Loading