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
This commit is contained in:
curben 2019-12-23 23:36:51 +00:00
parent a36b361d3b
commit f4375dc216
No known key found for this signature in database
GPG Key ID: 5D9DB57A25D34EE3
1 changed files with 17 additions and 11 deletions

View File

@ -14,23 +14,29 @@ test:
- npm install --only=prod snyk && npm run snyk # Refer to "scripts" in package.json - npm install --only=prod snyk && npm run snyk # Refer to "scripts" in package.json
- npm run hexo - npm run hexo
only: rules:
- master # only trigger when 'master' branch is pushed # Skip in renovate job
- if: '$RENOVATE == "true"'
# Don't run this job when renovate job runs when: never
except: # Only trigger through push event in master branch
- schedules - if: '$CI_COMMIT_REF_NAME == "master" && $CI_PIPELINE_SOURCE == "push"'
- web 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 renovate: # Check dependency update
script: script:
- npm install --only=prod renovate - npm install --only=prod renovate
- npm run renovate - npm run renovate
only: rules:
- schedules # trigger build by schedules # Only trigger when environment variable matches and through schedule in master branch
- web # trigger through "Run pipeline" button in GitLab.com - 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 # # Uncomment below (and comment/remove above) lines for gitlab pages
# image: node:latest # Use latest version of Node.js # image: node:latest # Use latest version of Node.js