From 6ac2630f53052630242735a28da1bb3d50147834 Mon Sep 17 00:00:00 2001 From: Spencer Gibb Date: Fri, 25 Sep 2015 11:13:05 -0600 Subject: [PATCH] update travis and ghpages --- .gitignore | 1 + .travis.yml | 6 +++--- docs/src/main/asciidoc/ghpages.sh | 24 ++++++++++++++++-------- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 0d6179a..9c2b5f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +_site *~ #* *# diff --git a/.travis.yml b/.travis.yml index 387bc35..872098f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,11 @@ before_install: - echo "https://$GH_TOKEN:@github.com" > .git/credentials - gem install asciidoctor install: -- ./mvnw install -P docs -q -U -DskipTests=true -Dmaven.test.redirectTestOutputToFile=true +- ./mvnw --settings .settings.xml install -P docs -q -U -DskipTests=true -Dmaven.test.redirectTestOutputToFile=true - ./docs/src/main/asciidoc/ghpages.sh script: -- '[ "${TRAVIS_PULL_REQUEST}" != "false" ] || ./mvnw --settings .settings.xml deploy -P release -nsu -Dmaven.test.redirectTestOutputToFile=true' -- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] || ./mvnw install -nsu -Dmaven.test.redirectTestOutputToFile=true' +- '[ "${TRAVIS_PULL_REQUEST}" != "false" ] || ./mvnw --settings .settings.xml deploy -nsu -Dmaven.test.redirectTestOutputToFile=true' +- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] || ./mvnw --settings .settings.xml install -nsu -Dmaven.test.redirectTestOutputToFile=true' env: global: - GIT_NAME="Dave Syer" diff --git a/docs/src/main/asciidoc/ghpages.sh b/docs/src/main/asciidoc/ghpages.sh index 9190575..e1063ce 100755 --- a/docs/src/main/asciidoc/ghpages.sh +++ b/docs/src/main/asciidoc/ghpages.sh @@ -12,13 +12,20 @@ if ! [ -d docs/target/generated-docs ]; then exit 0 fi +# Find name of current branch +################################################################### +branch=$TRAVIS_BRANCH +[ "$branch" == "" ] && branch=`git rev-parse --abbrev-ref HEAD` +target=. +if [ "$branch" != "master" ]; then target=./$branch; mkdir -p $target; fi + # Stash any outstanding changes ################################################################### git diff-index --quiet HEAD dirty=$? if [ "$dirty" != "0" ]; then git stash; fi -# Switch to gh-pages branch to sync it with master +# Switch to gh-pages branch to sync it with current branch ################################################################### git checkout gh-pages @@ -26,21 +33,22 @@ for f in docs/target/generated-docs/*; do file=${f#docs/target/generated-docs/*} if ! git ls-files -i -o --exclude-standard --directory | grep -q ^$file$; then # Not ignored... - cp -rf $f . - git add -A $file + cp -rf $f $target + git add -A $target/$file fi done -git commit -a -m "Sync docs from master to gh-pages" +git add -A README.adoc || echo "No change to README.adoc" +git commit -a -m "Sync docs from $branch to gh-pages" || echo "Nothing committed" # Uncomment the following push if you want to auto push to -# the gh-pages branch whenever you commit to master locally. +# the gh-pages branch whenever you commit to branch locally. # This is a little extreme. Use with care! ################################################################### -git push origin gh-pages +git push origin gh-pages || echo "Cannot push gh-pages" -# Finally, switch back to the master branch and exit block -git checkout master +# Finally, switch back to the current branch and exit block +git checkout $branch if [ "$dirty" != "0" ]; then git stash pop; fi exit 0