Skip to content

Instantly share code, notes, and snippets.

@mtvbrianking
Created March 28, 2020 17:47
Show Gist options
  • Save mtvbrianking/57faef18645e1e7f69c59ac18423610c to your computer and use it in GitHub Desktop.
Save mtvbrianking/57faef18645e1e7f69c59ac18423610c to your computer and use it in GitHub Desktop.
Gitlab pages deploy swagger docs
# https://gitlab.com/mbrian/ects-ea-docs/-/ci/lint
# This file is a template, and might need editing before it works on your project.
image: node:10-alpine
# specify the location of the Open API Specification files within your project
# and the filename of the specification that you would like to display by default
variables:
DOCS_FOLDER: "specs"
SPEC_TO_DISPLAY: "rects.yaml"
# These folders are cached between builds
cache:
paths:
- ./node_modules
# publishes all files from the $DOCS_FOLDER together with the static version of SwaggerUI
# sets the specification file named in $SPEC_TO_DISPLAY to be displayed by default
pages:
stage: deploy
before_script:
- npm install [email protected]
script:
- mkdir public
- cp -rp node_modules/swagger-ui-dist/* public
- cp -rp $DOCS_FOLDER/* public
- sed -i "s#https://petstore\.swagger\.io/v2/swagger\.json#$SPEC_TO_DISPLAY#g" public/index.html
artifacts:
paths:
- public
only:
- master
@aarongholder
Copy link

Does anybody know how to get this working with newer versions of Swagger UI?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment