diff --git a/.travis/create_artifacts.sh b/.travis/create_artifacts.sh index a5349cca34..287f45c1c2 100755 --- a/.travis/create_artifacts.sh +++ b/.travis/create_artifacts.sh @@ -26,6 +26,21 @@ if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then exit 0 fi +# if nightlies.sh has not written this TRAVIS_BUILD_NUMBER, there's no +# changes from last nigthly +if [ -f .travis/current_build_status ]; then + FILE_TRAVIS_BUILD_NUMBER=$(cut -d'#' -f2 < .travis/current_build_status) + FILE_TRAVIS_BUILD_STATUS=$(cut -d- -f1 < .travis/current_build_status) + if [[ ${FILE_TRAVIS_BUILD_NUMBER} -eq ${TRAVIS_BUILD_NUMBER} ]] && [[ ${FILE_TRAVIS_BUILD_STATUS} == "changes" ]]; then + echo "Changes happen since last nightly release, let's continue" + else + echo "No changes since last nightly release, nothing else to do" + exit 0 + fi +else + echo "File .travis/current_build_status doesn't exist, probably this is the very first build, let's continue" +fi + echo "--- Initialize git configuration ---" git checkout "${1-master}" git pull diff --git a/.travis/generate_changelog_for_nightlies.sh b/.travis/generate_changelog_for_nightlies.sh index 59173af3f6..0cfc3e1557 100755 --- a/.travis/generate_changelog_for_nightlies.sh +++ b/.travis/generate_changelog_for_nightlies.sh @@ -37,8 +37,9 @@ echo "Changelog created! Adding packaging/version(${NEW_VERSION}) and CHANGELOG. echo "${NEW_VERSION}" > packaging/version git add packaging/version && echo "1) Added packaging/version to repository" || FAIL=1 git add CHANGELOG.md && echo "2) Added changelog file to repository" || FAIL=1 -git commit -m '[ci skip] create nightly packages and update changelog' --author "${GIT_USER} <${GIT_MAIL}>" && echo "3) Committed changes to repository" || FAIL=1 -git push "https://${GITHUB_TOKEN}:@${PUSH_URL}" && echo "4) Pushed changes to remote ${PUSH_URL}" || FAIL=1 +git add .travis/current_build_status && echo "3) Added travis current build status file to repository" || FAIL=1 +git commit -m '[ci skip] create nightly packages and update changelog' --author "${GIT_USER} <${GIT_MAIL}>" && echo "4) Committed changes to repository" || FAIL=1 +git push "https://${GITHUB_TOKEN}:@${PUSH_URL}" && echo "5) Pushed changes to remote ${PUSH_URL}" || FAIL=1 # In case of a failure, wrap it up and bail out cleanly if [ $FAIL -eq 1 ]; then diff --git a/.travis/nightlies.sh b/.travis/nightlies.sh index 7240a784d6..1679afb237 100755 --- a/.travis/nightlies.sh +++ b/.travis/nightlies.sh @@ -31,6 +31,9 @@ PREVIOUS_NIGHTLY_COUNT="$(rev <packaging/version | cut -d- -f 2 | rev)" if [ "${COMMITS_SINCE_RELEASE}" == "${PREVIOUS_NIGHTLY_COUNT}" ]; then echo "No changes since last nightly release, nothing else to do" exit 0 +else + echo "Changes happen since last nightly release" + echo "changes-#${TRAVIS_BUILD_NUMBER}" > .travis/current_build_status fi if [ ! "${TRAVIS_REPO_SLUG}" == "netdata/netdata" ]; then