diff --git a/.gitignore b/.gitignore index b56f1dd..b4d3643 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,6 @@ build/ ### VS Code ### .vscode/ + +### Custom Ignored ### +/.travis/**.asc diff --git a/.travis.yml b/.travis.yml index 50ace6d..58975dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,23 +6,48 @@ language: java # https://docs.travis-ci.com/user/reference/trusty/#jvm-clojure-groovy-java-scala-images jdk: oraclejdk11 +# https://docs.travis-ci.com/user/job-lifecycle#skipping-the-installation-phase +install: skip + +before_script: + - chmod +x mvnw + # Each job in Travis CI has several steps: # https://docs.travis-ci.com/user/job-lifecycle/ # The 'language: java' directive sets up sane defaults to test common java applications. # We customize the script for compiling Maven application. For more about customizing the build: # https://docs.travis-ci.com/user/customizing-the-build script: - - ./mvnw install -Dmaven.javadoc.skip=true -B -V + - "./mvnw clean install -Dmaven.javadoc.skip=true -B -V" -before_install: - - chmod +x mvnw +before_deploy: + - openssl aes-256-cbc -K $encrypted_4f0d00631887_key -iv $encrypted_4f0d00631887_iv + -in .travis/gpg.asc.enc -out .travis/gpg.asc -d -# This is to enable Codecov's coverage. If the build is successful, the code is submitted for code coverage analysis. -#after_success: -# - bash <(curl -s https://codecov.io/bash) +deploy: + - skip_cleanup: true + provider: script + script: ./deploy.sh + on: + branch: master + - skip_cleanup: true + provider: script + script: ./deploy.sh + on: + tags: true # https://docs.travis-ci.com/user/notifications#default-notification-settings notifications: email: on_success: change on_failure: always + +# https://docs.travis-ci.com/user/environment-variables/ +# https://docs.travis-ci.com/user/encryption-keys#usage +# https://docs.travis-ci.com/user/encrypting-files/ +env: + global: + - secure: "EcN7//MxH2sPb0sC4xIDRXbo0/qU7KSir+zBZeXQdyGm1GO9FZJQyLt4gCRabUk8603WPAgBWWAHyeBSnOvQATZ/+4p+qpWmJE0+qZXV3V8WGsS9MoavV5HHxd8kU4T4Un/BdL/2SEmlGml8hQrLYFK+gup8sKZ2txou5/NINK3kqriZIBX8vN/hsz5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Wbnn4dgW16sBCgdi0CH8RTH7mWEMuiBF6Rm4lrlnya2oKp4HYuwtqdxFpMiZehFzQ6U9eKky4KrBHsWSQgdT1w9Avrv0yuf3sj98a/TiMOqcSuH3EP3LI0APDTIQxtf0Ji+wB/fyw3td+ZTiDqUIjAe8o5DG0/4zZkO2/Ke3XORz2rljKfL26Jl8ai3+5uqAyubT8pxza29i2puWwVWdLxHcA0iIFbDYzVQRVSsozvz/jzktSa71H+Tb0MOES4hznBxBpktlc8mQTO8FQUVX+1Q/gH8gT6eo2TryJeMh5x70UvELBopmKJNs2eubbopJWRHtTHFPBO+LvJrqpCc1rcJY1vghcHb0+onAp87XjpgyBRWQAgIeUALZSkljxcU82sNl4FF/ILlEIqeFsCu4=" diff --git a/.travis/gpg.asc.enc b/.travis/gpg.asc.enc new file mode 100644 index 0000000..c925d89 Binary files /dev/null and b/.travis/gpg.asc.enc differ diff --git a/.travis/maven-settings.xml b/.travis/maven-settings.xml new file mode 100644 index 0000000..246a786 --- /dev/null +++ b/.travis/maven-settings.xml @@ -0,0 +1,26 @@ + + + + ossrh + ${env.OSSRH_USERNAME} + ${env.OSSRH_PASSWORD} + + + + + + ossrh + + true + + + gpg + ${env.GPG_KEY_NAME} + ${env.GPG_PASSPHRASE} + + + + diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 0000000..6833a90 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# expects variables to be set: +# - OSSRH_USERNAME +# - OSSRH_PASSWORD +# - GPG_KEY_NAME +# - GPG_PASSPHRASE +# expects file to exist: +# - .travis/gpg.asc + +set -e + +# Check the variables are set +if [ -z "$OSSRH_USERNAME" ]; then + echo "missing environment value: OSSRH_USERNAME" >&2 + exit 1 +fi + +if [ -z "$OSSRH_PASSWORD" ]; then + echo "missing environment value: OSSRH_PASSWORD" >&2 + exit 1 +fi + +if [ -z "$GPG_KEY_NAME" ]; then + echo "missing environment value: GPG_KEY_NAME" >&2 + exit 1 +fi + +if [ -z "$GPG_PASSPHRASE" ]; then + echo "missing environment value: GPG_PASSPHRASE" >&2 + exit 1 +fi + +# Prepare the local keyring (requires travis to have decrypted the file +# beforehand) +gpg --fast-import .travis/gpg.asc + +if [ ! -z "$TRAVIS_TAG" ]; then + echo "on a tag -> set pom.xml to $TRAVIS_TAG" + mvn --settings "${TRAVIS_BUILD_DIR}/.travis/mvn-settings.xml" org.codehaus.mojo:versions-maven-plugin:2.7:set -DnewVersion=$TRAVIS_TAG 1>/dev/null 2>/dev/null +else + echo "not on a tag -> keep snapshot version in pom.xml" +fi + +# Run the maven deploy steps +mvn deploy -P publish -DskipTests=true --settings "${TRAVIS_BUILD_DIR}/.travis/mvn-settings.xml" diff --git a/pom.xml b/pom.xml index b932a17..e6205a1 100644 --- a/pom.xml +++ b/pom.xml @@ -84,19 +84,18 @@ - - - sonatype_releases - Nexus Release Repository - - https://oss.sonatype.org/service/local/staging/deploy/maven2 - - sonatype_snapshots + ossrh Nexus Snapshot Repository https://oss.sonatype.org/content/repositories/snapshots + + + ossrh + Nexus Release Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2 + @@ -153,9 +152,9 @@ 1.6.8 true - sonatype_releases + ossrh https://oss.sonatype.org/ - false + true