From f4375dc2163547885c3331a3b549eb8093d8ef14 Mon Sep 17 00:00:00 2001 From: curben <2809763-curben@users.noreply.gitlab.com> Date: Mon, 23 Dec 2019 23:36:51 +0000 Subject: [PATCH] ci: replace only/except with rules syntax - https://docs.gitlab.com/ee/ci/yaml/README.html#rules - only/except may be deprecated in future * https://docs.gitlab.com/ee/ci/yaml/README.html#onlyexcept-basic --- .gitlab-ci.yml | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d04a26e..4f28072 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,23 +14,29 @@ test: - npm install --only=prod snyk && npm run snyk # Refer to "scripts" in package.json - npm run hexo - only: - - master # only trigger when 'master' branch is pushed - -# Don't run this job when renovate job runs - except: - - schedules - - web + rules: + # Skip in renovate job + - if: '$RENOVATE == "true"' + when: never + # Only trigger through push event in master branch + - if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "push"' + when: always + # Only trigger through "Run pipeline" in master branch + - if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "web"' + when: always renovate: # Check dependency update script: - npm install --only=prod renovate - npm run renovate - only: - - schedules # trigger build by schedules - - web # trigger through "Run pipeline" button in GitLab.com - + rules: + # Only trigger when environment variable matches and through schedule in master branch + - if: '$RENOVATE == "true" && $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "schedule"' + when: always + # Only trigger when environment variable matches and through "Run pipeline" in master branch + - if: '$RENOVATE == "true" && $CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "web"' + when: always # # Uncomment below (and comment/remove above) lines for gitlab pages # image: node:latest # Use latest version of Node.js