language: java sudo: required jdk: - openjdk8 services: - docker stages: - build - name: docker-tag if: (tag IS present) AND (branch = master) AND (type != pull_request) - name: docker-push if: (branch = master) AND (type != pull_request) jobs: include: - stage: build name: war script: mvn --batch-mode --define java.net.useSystemProxies=true package before_deploy: cp target/plantuml.war target/plantuml-${TRAVIS_BRANCH}.war deploy: provider: releases api_key: "$GITHUB_TOKEN" file: "target/plantuml-${TRAVIS_BRANCH}.war" skip_cleanup: true on: tags: true - stage: docker-tag name: jetty script: - if [ -z "$TRAVIS_TAG" ]; then exit 0; fi - docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - docker build --pull -t plantuml/plantuml-server:jetty-$TRAVIS_TAG -f Dockerfile.jetty . - docker push plantuml/plantuml-server:jetty-$TRAVIS_TAG on: tags: true - stage: docker-tag name: tomcat script: - if [ -z "$TRAVIS_TAG" ]; then exit 0; fi - docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - docker build --pull -t plantuml/plantuml-server:tomcat-$TRAVIS_TAG -f Dockerfile.tomcat . - docker push plantuml/plantuml-server:tomcat-$TRAVIS_TAG on: tags: true - stage: docker-push name: jetty script: - docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - docker build --pull -t plantuml/plantuml-server:jetty -f Dockerfile.jetty . - docker tag plantuml/plantuml-server:jetty plantuml/plantuml-server:latest - docker push plantuml/plantuml-server:jetty - docker push plantuml/plantuml-server:latest - stage: docker-push name: tomcat script: - docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - docker build --pull -t plantuml/plantuml-server:tomcat -f Dockerfile.tomcat . - docker push plantuml/plantuml-server:tomcat