language: java
sudo: false

before_install:
  - openssl aes-256-cbc -d -pass "env:DECRYPT_KEYPHRASE" -in .gnupg.tar.enc | tar xv
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - "if [[ ${TRAVIS_TAG} != '' ]]; then mvn versions:set -DnewVersion='${TRAVIS_TAG}'; fi"

script: mvn clean verify

after_success:
  - mvn jacoco:report coveralls:report
  - "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} == '' ]] && mvn deploy -DreposityId=sonatype-nexus-snapshots -DskipTests --settings deploy-settings.xml"
  - "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} != '' ]] && mvn deploy -DreposityId=sonatype-nexus-staging -DskipTests --settings deploy-settings.xml"

language: java
sudo: false

before_install:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - 'if [[ -n "$DECRYPT_KEYPHRASE" ]]; then openssl aes-256-cbc -d -pass "env:DECRYPT_KEYPHRASE" -in .gnupg.tar.enc | tar xv; fi'
  - 'if [[ ${TRAVIS_TAG} != "" ]]; then mvn versions:set -DnewVersion="${TRAVIS_TAG}"; fi'

script: mvn clean verify

after_success:
  - mvn jacoco:report coveralls:report
  - "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} == '' ]] && mvn deploy -DreposityId=sonatype-nexus-snapshots -DskipTests --settings deploy-settings.xml"
  - "[[ ${TRAVIS_PULL_REQUEST} == 'false' ]] && [[ ${TRAVIS_TAG} != '' ]] && mvn deploy -DreposityId=sonatype-nexus-staging -DskipTests --settings deploy-settings.xml"

Decrypt secrets only when passphrase is present
Decrypt secrets only when passphrase is present

In cas a pull request is tested, the secret environment variables are not
present, because they could be exposed by a malicious pull request. So we can
only decrypt the gpg-keys only when the keyphrase is availible.
