-
David Schwarzmann authoredDavid Schwarzmann authored
.gitlab-ci.yml 1.09 KiB
stages:
- lint
- build
- upload
lint:
stage: lint
image:
name: $CI_REGISTRY/stoplight/spectral:latest
entrypoint: [ "" ]
script:
- spectral lint spec/*.yml
build:
stage: build
image: $CI_REGISTRY/node:current-alpine
before_script:
- npm install -g @apidevtools/swagger-cli
- mkdir dist
script:
- swagger-cli bundle -t yaml -o dist/zustelldienst.yml spec/zustelldienst.yml
artifacts:
expose_as: 'Built API spec'
paths:
- dist/
expire_in: 30 days
upload:
stage: upload
image: $CI_REGISTRY/alpine:latest
only:
refs:
- tags
variables:
- $CI_COMMIT_TAG
before_script:
- apk add rsync openssh-client
- eval $(ssh-agent -s)
- echo "$CI_DEPLOYMENT_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$UBERSPACE_KNOWN_HOST" >> ~/.ssh/known_hosts
script:
- sed -i "s,API_VERSION,$CI_COMMIT_TAG,g" dist/zustelldienst.yml
- rsync -Lvz -e "ssh -o CheckHostIP=no" ./dist/zustelldienst.yml fitko@dorado.uberspace.de:schema.fitko.de/fit-connect/openapi/$CI_COMMIT_TAG/