diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1df043a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,43 @@ +language: java +jdk: + - oraclejdk8 + +os: + - linux + +# run in container +sudo: false + +# use framebuffer for UI +before_install: + - export DISPLAY=:99.0 + - sh -e /etc/init.d/xvfb start + +env: + global: + # ENC_PWD + - secure: "gKAzrngDxttmaZ5PM7zhlYmZOC9OGDc5vFhV3LZ3t+QRebQd+rZMrYqu71+BjlSbHM9Lp5Fj59yEjv5dkRPMbVdAVvQBK4pfBuOmrY5XJqqADDR63EI7QSiC7wzWP776mW7rb22DJKcyGf4FjnfDdXU9LENcmM2xMAjx0aNxL+A=" + # GH_TOKEN + - secure: "aMKCaSTnelmitm7ubPFPNzEsXMLsB/aa6ttycyHn3vNUtrfEdrvgK3rgTs6KPdwvvlCsh845GqHZjtcNh+q74Bn+R73JQRe2m+IHk61DFhEj1U78kB14rtALkN4pX32HgLonPpKwVxfnAUc1jGWsXsNlSV8rtGMto5gTcqVK9yM=" + +# publish artifacts and Javadoc after a successful build +after_success: + - travis/publish.sh + +before_deploy: + - export VERSION=$(gradle -q getVersion) +deploy: + provider: releases + api_key: + secure: "bpAttvhKOyYLTWJzQqBIGcCDZXC7ZV42D/OhztSDC1DDye5B2s1yNwwAvBvzftuiQUyHWG4Rr6o+Y0ZXdEuKPm8ABYqnaUDfEXuaP8mtKrVRB1np1NDY3MBCJalzBQe1/RHh7sm4zzvLWRndxaY76kmJA5gC5PMOtk3GDubIKmU=" + file_glob: true + file: + - "build/libs/flowless-${VERSION}.jar" + - "build/libs/flowless-${VERSION}-javadoc.jar" + - "build/libs/flowless-${VERSION}-sources.jar" + - "build/libs/flowless-fat-${VERSION}.jar" + skip_cleanup: true + on: + tags: true + branch: master + repo: TomasMikula/Flowless diff --git a/build.gradle b/build.gradle index c262aed..530972a 100644 --- a/build.gradle +++ b/build.gradle @@ -53,3 +53,7 @@ task fatJar(type: Jar, dependsOn: classes) { } assemble.dependsOn fatJar + +task getVersion << { + println version +} diff --git a/gradle.properties.enc b/gradle.properties.enc new file mode 100644 index 0000000..61dc447 --- /dev/null +++ b/gradle.properties.enc @@ -0,0 +1,2 @@ +Salted__`&y™RûpɈhÓž¹€œZ… !—Zk‘Χ%šÄ†ÒFýÇ m§°¾ Q|rîAE&4ó¶8,Zu׃~âê d*ê.:ÊgÒ·Û™X:ßÔ' ܶÃá¡V{e²BEk‚ëŠXü¶ŠÔúS®Œþ¶+Ð~` +‡ÁŠº£aÍ¿Ýõ%`B°•8À)ÞyH»þöèЈíÚÇßcÊ”À1Áù>ÈŠHtÒ¨‡üò»nž \ No newline at end of file diff --git a/secring.gpg.enc b/secring.gpg.enc new file mode 100644 index 0000000..ec6a4db Binary files /dev/null and b/secring.gpg.enc differ diff --git a/travis/publish.sh b/travis/publish.sh new file mode 100755 index 0000000..2989bb9 --- /dev/null +++ b/travis/publish.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +if [ "$TRAVIS_REPO_SLUG" == "TomasMikula/Flowless" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then + openssl aes-256-cbc -d -k "$ENC_PWD" -in gradle.properties.enc -out gradle.properties + openssl aes-256-cbc -d -k "$ENC_PWD" -in secring.gpg.enc -out secring.gpg + + echo -e "Starting publish to Sonatype...\n" + + gradle uploadArchives + RETVAL=$? + + if [ $RETVAL -eq 0 ]; then + echo 'Publish completed!' + else + echo 'Publish failed.' + return 1 + fi + + # publish Javadoc for non-SNAPSHOT versions + VERSION=$(gradle -q getVersion) + if [[ $VERSION != *SNAPSHOT* ]]; then + + echo -e "Publishing javadoc...\n" + + git config --global user.email "travis@travis-ci.org" + git config --global user.name "travis-ci" + git config --global push.default simple + git clone --quiet https://${GH_TOKEN}@github.com/FXMisc/fxmisc.github.io fxmisc + + cd fxmisc + JAVADOC_DIR=./flowless/javadoc/$VERSION + git rm -rf $JAVADOC_DIR + cp -Rf ../build/docs/javadoc $JAVADOC_DIR + git add -f $JAVADOC_DIR + git commit -m "Javadoc for Flowless v$VERSION" + git push + + fi + +fi