diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6d43e6aa..8d52eead 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,6 +31,9 @@ build: # Build. - ./scripts/image_build.sh $CI_PROJECT_PATH $CI_COMMIT_REF_NAME $CI_COMMIT_SHA only: + refs: + - branches + - tags variables: - $CD_DOCKER_USERNAME - $CD_DOCKER_PASSWORD @@ -54,6 +57,7 @@ deploy: only: refs: - branches + - tags variables: - $CD_DOCKER_USERNAME - $CD_DOCKER_PASSWORD diff --git a/.travis.yml b/.travis.yml index e34890bd..dc2f28b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ jobs: - stage: build name: build docker image script: bash scripts/image_build.sh $TRAVIS_REPO_SLUG $TRAVIS_BRANCH $TRAVIS_COMMIT - if: !env(TRAVIS_PULL_REQUEST) AND env(CD_BUILD_IGNORE) IS NOT present AND env(CD_DOCKER_USERNAME) IS present AND env(CD_DOCKER_PASSWORD) IS present + if: type NOT IN (pull_request) AND env(CD_BUILD_IGNORE) IS NOT present AND env(CD_DOCKER_USERNAME) IS present AND env(CD_DOCKER_PASSWORD) IS present notifications: email: false diff --git a/scripts/image_build.sh b/scripts/image_build.sh index 0bf3295a..024a75e9 100755 --- a/scripts/image_build.sh +++ b/scripts/image_build.sh @@ -52,7 +52,7 @@ fi # Set the version tag when it is a release or the commit sha was included. if [[ "$CD_REF_NAME" == *"release"* ]]; then - sed -i "s/VERSION =.*/VERSION = \"$(expr substr $CD_REF_NAME 9)\"/g" config/initializers/version.rb + sed -i "s/VERSION =.*/VERSION = \"${CD_REF_NAME:8}\"/g" config/initializers/version.rb elif [ ! -z $CD_COMMIT_SHA ]; then sed -i "s/VERSION =.*/VERSION = \"$CD_REF_NAME ($(expr substr $CD_COMMIT_SHA 1 8))\"/g" config/initializers/version.rb fi