Skip to content
Snippets Groups Projects
Commit ccf53516 authored by Ernesto Rico Schmidt's avatar Ernesto Rico Schmidt
Browse files

Add deploy_spec and use spectacular to generate it

parent cc083c53
No related branches found
No related tags found
No related merge requests found
Pipeline #1956 failed
......@@ -8,8 +8,10 @@
stages:
- build
- deploy
- release
build-openapi-scheme:
stage: build
image: python:3.9-alpine
......@@ -20,14 +22,39 @@ build-openapi-scheme:
# variable is present. It’s probably a good idea to refactor this to
# something more explicit.
VIRTUAL_ENV: 1
OPENAPI_JSON: ./public/api.json
before_script:
- apk add gcc musl-dev zlib-dev jpeg-dev libmagic
- pip install -r requirements.txt
script:
- python3 -m django spectacular --validate --lang en --file openapi.yaml
- mkdir public
- python3 -m django spectacular --validate --lang en --format openapi-json --file $OPENAPI_JSON
artifacts:
paths:
- openapi.yaml
- $OPENAPI_JSON
deploy_spec:
stage: deploy
before_script:
- apt-get --quiet update
- apt-get --quiet --yes install nodejs npm lftp
- nodejs -v
- npm i -g npm@latest
- npm install swagger-ui-dist@3.52.5
script:
- cp -rp node_modules/swagger-ui-dist/* ./public
- 'sed -i "s@.*url.*@url: \"api.json\",@" ./public/index.html'
- echo "Deploying AURA Steering API Spec..."
- lftp -c "set ftp:ssl-allow no; open -u $FTP_AURA_RADIO_USER,$FTP_AURA_RADIO_PWD $FTP_AURA_RADIO_HOST; mirror -Rnev ./public/ ./api.aura.radio/steering --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
- echo "AURA Steering API Spec successfully deployed."
artifacts:
paths:
- public
expire_in: 2 days
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: always
docker-push:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment