Skip to content

Commit

Permalink
Publish demo app and javadoc to gh-pages snapshot upon successful build.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjardine committed Oct 26, 2015
1 parent 4b45e1e commit 17af645
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 2 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

2 changes: 1 addition & 1 deletion deploy.sh → .utility/deploy.sh
Original file line number Diff line number Diff line change
@@ -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 "<settings><servers><server><id>ossrh</id><username>\${env.OSSRH_USER}</username><password>\${env.OSSRH_PASS}</password></server></servers></settings>" > ~/settings.xml
mvn deploy --settings ~/settings.xml
fi
37 changes: 37 additions & 0 deletions .utility/gh_pages.sh
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
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
19 changes: 19 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,25 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven-javadoc-plugin.version}</version>
<configuration>
<noqualifier>all</noqualifier>
<reportOutputDirectory>${project.build.directory}/javadoc</reportOutputDirectory>
<destDir>javadoc</destDir>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>install</phase>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
Expand Down

0 comments on commit 17af645

Please sign in to comment.