stages: - lint - build - upload lint: stage: lint image: name: $CI_REGISTRY/stoplight/spectral:latest entrypoint: [ "" ] script: - spectral lint spec/*.yml openapi4j-parser: stage: lint image: $CI_REGISTRY/node:current-buster before_script: - npm install -g @apidevtools/swagger-cli - export DEBIAN_FRONTEND=noninteractive - apt-get update && apt-get install -y openjdk-11-jre && rm -rf /var/lib/apt/lists/* script: - swagger-cli bundle -t yaml -o "spec/zustelldienst-bundled.yml" "spec/zustelldienst.yml" - java -jar openapi4j-parser-cli-1.0.0.jar "spec/zustelldienst-bundled.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/