diff --git a/.travis.yml b/.travis.yml index e167f69da..a9a4a418d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,6 @@ +# token will allow updating the gh-pages branch of the repository. +secure: "WK1EyUiO76VPcWanCxtBhL7IWTUaCZbzG/x9Xs/TnsL6PaZVdIgxBbEOuUbgwPwFAeKvgah3a2+OFHF7vvFkxZypHSuZqi1yrlZ/l52p07jG4PqzwMiaGwJpqitnfOALucrXOuQnFQ5My5o8ApkXLEgRMG6MSb8LXotSliUVWmQ=" + sudo: false language: java @@ -15,4 +18,6 @@ script: - mvn clean install -DdryRun=true -Dlicense.failOnMissingHeader=true -Dlicense.failOnNotUptodateHeader=true after_success: - - ./deploy.sh + - ./.utility/deploy.sh + - ./.utility/gh_pages.sh + \ No newline at end of file diff --git a/deploy.sh b/.utility/deploy.sh similarity index 65% rename from deploy.sh rename to .utility/deploy.sh index 267b06771..ccb72e754 100755 --- a/deploy.sh +++ b/.utility/deploy.sh @@ -1,6 +1,6 @@ #!/bin/bash set -ev -if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then +if [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then echo "ossrh\${env.OSSRH_USER}\${env.OSSRH_PASS}" > ~/settings.xml mvn deploy --settings ~/settings.xml fi diff --git a/.utility/gh_pages.sh b/.utility/gh_pages.sh new file mode 100644 index 000000000..0ce45449f --- /dev/null +++ b/.utility/gh_pages.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -ev +if [ "$TRAVIS_JDK_VERSION" == "oraclejdk7" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "master" ]; then + +echo -e "Publishing snapshot demo app and javadoc . . .\n" + +cp -R target/javadoc $HOME/javadoc-latest + +git config --global user.email "travis@travis-ci.org" +git config --global user.name "travis-ci" + +# clone and build the demo application. +cd $HOME +git clone --quiet --branch=master https://${GH_TOKEN}@github.com/gwtbootstrap3/gwtbootstrap3-demo demo > /dev/null +cd demo +mvn clean package + +# clone the gh-pages branch. +cd $HOME +git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/gwtbootstrap3/gwtbootstrap3-demo gh-pages > /dev/null +cd gh-pages + +# remove the GwtBootstrap3Demo and apidocs directories from git. +git rm -rf ./snapshot/GwtBootstrap3Demo +git rm -rf ./snapshot/apidocs + +# copy the new GwtBootstrap3Demo and apidocsto the snapshot dir. +cp -Rf $HOME/javadoc-latest ./snapshot/apidocs +unzip $HOME/demo/target/gwtbootstrap3-demo-*.war -d ./snapshot/ + +git add -f . +git commit -m "Lastest javadoc and demo app on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages" +git push -fq origin gh-pages > /dev/null + +echo -e "Published Javadoc and demo application to gh-pages.\n" + +fi diff --git a/pom.xml b/pom.xml index 6148660ac..f4177289a 100644 --- a/pom.xml +++ b/pom.xml @@ -90,6 +90,25 @@ + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + all + ${project.build.directory}/javadoc + javadoc + + + + attach-javadocs + install + + javadoc + + + + org.codehaus.mojo license-maven-plugin