fling/.drone.yml
Armin Friedl 0c1fe8efce
All checks were successful
continuous-integration/drone/push Build is passing
Remove invalid constraints, prepare python generator for deployment
2020-07-13 21:55:02 +02:00

113 lines
2.9 KiB
YAML

kind: pipeline
type: docker
name: default
steps:
- name: build-service
image: maven:3.6-jdk-11
volumes:
- name: m2-cache
path: /root/.m2
environment:
NEXUS_USER:
from_secret: nexus_user
NEXUS_PASSWORD:
from_secret: nexus_password
commands:
- mkdir -p /root/.m2
- cp service/settings.xml /root/.m2/settings.xml
- cd service/fling
- mvn -Pprod clean deploy
- name: runservice
image: adoptopenjdk:11-jre-hotspot
commands:
- cd service/fling/target
- java -jar fling-0.1.0-SNAPSHOT.jar
detach: true
- name: generate-clients
image: alpine
environment:
NEXUS_USER:
from_secret: nexus_user
NEXUS_PASSWORD:
from_secret: nexus_password
commands:
- apk add --update --no-cache openjdk11 npm
- sleep 20
- npm install @openapitools/openapi-generator-cli -g
# Python client
- openapi-generator generate
-i http://runservice:8080/v3/api-docs
-g python
--additional-properties packageName=flingclient
-o flingclient.py
--enable-post-process-file
- cd flingclient.py
- |+
cat << EOF
[distutils]
index-servers =
nexus
[private-repository]
repository = <private-repository URL>
username = <private-repository username>
password = <private-repository password>
EOF >> .pypirc
- cat .pypirc
- cd ..
# JavaScript client
- openapi-generator generate
-i http://runservice:8080/v3/api-docs
-g javascript
--additional-properties projectName=@fling/flingclient,usePromises=true,npmRepository=https://nexus.friedl.net/repository/npm-private/
-o flingclient.js
--enable-post-process-file
- cd flingclient.js && npm install && npm run build
- echo "https://nexus.friedl.net/repository/npm-private/" >> .npmrc
- echo -n "_auth=" >> .npmrc && echo -n "$NEXUS_USER:$NEXUS_PASSWORD" | base64 >> .npmrc
- echo "email=dev@friedl.net" >> .npmrc
- npm publish
- name: build-web
image: node:latest
volumes:
- name: node-cache
path: /drone/src/web/fling/node_modules
environment:
NEXUS_USER:
from_secret: nexus_user
NEXUS_PASSWORD:
from_secret: nexus_password
VERSION: 0.1.0-snapshot
commands:
- ls -al
- cd web/fling
- npm install && npm run build
- tar czf fling-web-$VERSION.tar.gz build/
- curl --user "$NEXUS_USER:$NEXUS_PASSWORD"
--upload-file ./fling-web-$VERSION.tar.gz
https://nexus.friedl.net/repository/build-artifacts/fling-web-$VERSION.tar.gz
- name: publish
image: plugins/docker
settings:
username:
from_secret: docker_username
password:
from_secret: docker_password
dockerfile: container/Dockerfile
context: ./container
repo: arminfriedl/fling
tags: 0.1.0-snapshot
build_args:
- VERSION=0.1.0-snapshot
volumes:
- name: m2-cache
host:
path: /var/services/drone/cache/fling/m2
- name: node-cache
host:
path: /var/services/drone/cache/fling/node