[ci] [docs] Improved detection for changes in documentation

Now only updating docs on sourceforge, if there are changes
This commit is contained in:
Andreas Dangel
2018-06-20 20:57:27 +02:00
parent d3482ecd58
commit a89d5413ab
5 changed files with 15 additions and 17 deletions

View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
set -e set -e
source .travis/common-functions.sh
source .travis/logger.sh source .travis/logger.sh
source .travis/common-functions.sh
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1) VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
log_info "Building PMD Coveralls.io report ${VERSION} on branch ${TRAVIS_BRANCH}" log_info "Building PMD Coveralls.io report ${VERSION} on branch ${TRAVIS_BRANCH}"

View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
set -e set -e
source .travis/common-functions.sh
source .travis/logger.sh source .travis/logger.sh
source .travis/common-functions.sh
function push_docs() { function push_docs() {
if git diff --quiet docs; then if git diff --quiet docs; then

View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
set -e set -e
source .travis/common-functions.sh
source .travis/logger.sh source .travis/logger.sh
source .travis/common-functions.sh
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1) VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
log_info "Building PMD Documentation ${VERSION} on branch ${TRAVIS_BRANCH}" log_info "Building PMD Documentation ${VERSION} on branch ${TRAVIS_BRANCH}"
@ -41,7 +41,7 @@ zip -qr pmd-doc-${VERSION}.zip pmd-doc-${VERSION}/
fi fi
# rsync site to pmd.sourceforge.net/snapshot # rsync site to pmd.sourceforge.net/snapshot
if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]]; then if [[ "${VERSION}" == *-SNAPSHOT && "${TRAVIS_BRANCH}" == "master" ]] && has_docs_change; then
echo -e "\n\n" echo -e "\n\n"
log_info "Uploading snapshot site to pmd.sourceforge.net/snapshot..." log_info "Uploading snapshot site to pmd.sourceforge.net/snapshot..."
travis_wait rsync -ah --stats --delete pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/ travis_wait rsync -ah --stats --delete pmd-doc-${VERSION}/ ${PMD_SF_USER}@web.sourceforge.net:/home/project-web/pmd/htdocs/snapshot/
@ -57,18 +57,6 @@ zip -qr pmd-doc-${VERSION}.zip pmd-doc-${VERSION}/
has_docs_change() {
if [[ $(git diff --name-only ${TRAVIS_COMMIT_RANGE}) = *"docs/"* ]]; then
log_info "Checking for changes in docs/ (TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}): changes found"
return 0
else
log_info "Checking for changes in docs/ (TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}): no changes"
return 1
fi
}
# #
# Push the generated site to gh-pages branch # Push the generated site to gh-pages branch
# #

View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
set -e set -e
source .travis/common-functions.sh
source .travis/logger.sh source .travis/logger.sh
source .travis/common-functions.sh
VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1) VERSION=$(./mvnw -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.5.0:exec | tail -1)
log_info "Building PMD Sonar ${VERSION} on branch ${TRAVIS_BRANCH}" log_info "Building PMD Sonar ${VERSION} on branch ${TRAVIS_BRANCH}"

View File

@ -26,3 +26,13 @@ function travis_isPush() {
return 1 return 1
fi fi
} }
function has_docs_change() {
if [[ $(git diff --name-only ${TRAVIS_COMMIT_RANGE}) = *"docs/"* ]]; then
log_info "Checking for changes in docs/ (TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}): changes found"
return 0
else
log_info "Checking for changes in docs/ (TRAVIS_COMMIT_RANGE=${TRAVIS_COMMIT_RANGE}): no changes"
return 1
fi
}