diff --git a/.travis.yml b/.travis.yml index 6dbe8b0..b784b4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,26 @@ language: java + jdk: - oraclejdk8 -install: mvn install -P !build-extras -DskipTests=true -Dmaven.javadoc.skip=true -B -V -script: mvn test -P !build-extras -B -after_success: - - mvn clean test jacoco:report coveralls:report -P record-coverage,!build-extras -B - - chmod +x src/main/build/mvndeploy.sh && ./src/main/build/mvndeploy.sh + +script: mvn install --batch-mode --show-version + +deploy: + - provider: script + script: bash src/main/build/mvndeploy.sh + skip_cleanup: true + on: + repo: fxnn/brainfuck + branch: master + - provider: script + script: bash src/main/build/mvndeploy.sh + skip_cleanup: true + on: + repo: fxnn/brainfuck + tags: true + - provider: script + script: bash src/main/build/jacoco-report.sh + cache: directories: - ~/.m2/repository \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6e0eab8..cca9069 100644 --- a/pom.xml +++ b/pom.xml @@ -180,9 +180,6 @@ build-extras - - true - diff --git a/src/main/build/jacoco-report.sh b/src/main/build/jacoco-report.sh new file mode 100644 index 0000000..059e95b --- /dev/null +++ b/src/main/build/jacoco-report.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -e + +mvn clean test jacoco:report coveralls:report -P record-coverage --batch-mode \ No newline at end of file diff --git a/src/main/build/mvndeploy.sh b/src/main/build/mvndeploy.sh index 0e9223f..a3e3c2d 100644 --- a/src/main/build/mvndeploy.sh +++ b/src/main/build/mvndeploy.sh @@ -2,13 +2,24 @@ # based on http://www.debonair.io/post/maven-cd/ set -e - DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" -if [ "$TRAVIS_BRANCH" = 'master' ] && [ "$TRAVIS_PULL_REQUEST" == 'false' ]; then - openssl aes-256-cbc \ - -K $encrypted_8f8b80a3f07f_key -iv $encrypted_8f8b80a3f07f_iv \ - -in $DIR/codesigning.asc.enc -out $DIR/codesigning.asc -d - gpg --fast-import $DIR/codesigning.asc - mvn deploy -P sign,build-extras --settings $DIR/mvnsettings.xml -fi \ No newline at end of file +echo "Importing GPG key" +echo +openssl aes-256-cbc \ + -K $encrypted_8f8b80a3f07f_key -iv $encrypted_8f8b80a3f07f_iv \ + -in $DIR/codesigning.asc.enc -out $DIR/codesigning.asc -d +gpg --fast-import $DIR/codesigning.asc +echo + +if [ "$TRAVIS_TAG" != "" ]; then + echo "Releasing version $TRAVIS_TAG" + echo + mvn versions:set -DnewVersion=$TRAVIS_TAG -DgenerateBackupPoms=false + echo +fi + +echo "Deploying to repository" +echo +mvn deploy -P sign,build-extras --settings $DIR/mvnsettings.xml +echo