From c728d6a2c0ab51ad9f731a4d9db7c26cb22d698c Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Thu, 24 Oct 2019 02:47:52 +0800 Subject: [PATCH] Improve Travis CI deploy/send PR condition Originally it supports only Dockerfile changes, with this adjustment, it'll now send pull request to the downstream for the version and tag array in generate-stackbrew-library.sh file. --- .travis.yml | 11 +++++++++-- travis.yml.template | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 17e4d1e890..9c78b6ddd0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -99,8 +99,15 @@ jobs: before_script: - | if ! git diff --name-only "$TRAVIS_COMMIT_RANGE" -- | grep -Eq "Dockerfile$"; then - echo "Skip deployment as none of the Dockerfiles has been changed." - exit + if git diff --name-only "$TRAVIS_COMMIT_RANGE" -- | grep -Eq "^generate-stackbrew-library.sh$"; then + if ! git diff "$TRAVIS_COMMIT_RANGE" -- generate-stackbrew-library.sh | grep -Eq '^[-+]array_[0-9]'; then + echo "Skip deployment as none of the Dockerfiles and version tag array in generate-stackbrew-library.sh has been changed." + exit + fi + else + echo "Skip deployment as none of the Dockerfiles and generate-stackbrew-library.sh has been changed." + exit + fi fi script: - ./generate-stackbrew-pr.sh "$TRAVIS_COMMIT_RANGE" diff --git a/travis.yml.template b/travis.yml.template index cf7b414125..d28f814ab1 100644 --- a/travis.yml.template +++ b/travis.yml.template @@ -97,8 +97,15 @@ jobs: before_script: - | if ! git diff --name-only "$TRAVIS_COMMIT_RANGE" -- | grep -Eq "Dockerfile$"; then - echo "Skip deployment as none of the Dockerfiles has been changed." - exit + if git diff --name-only "$TRAVIS_COMMIT_RANGE" -- | grep -Eq "^generate-stackbrew-library.sh$"; then + if ! git diff "$TRAVIS_COMMIT_RANGE" -- generate-stackbrew-library.sh | grep -Eq '^[-+]array_[0-9]'; then + echo "Skip deployment as none of the Dockerfiles and version tag array in generate-stackbrew-library.sh has been changed." + exit + fi + else + echo "Skip deployment as none of the Dockerfiles and generate-stackbrew-library.sh has been changed." + exit + fi fi script: - ./generate-stackbrew-pr.sh "$TRAVIS_COMMIT_RANGE"