fix(ci): only run pipeline when scheduled or "Run pipeline" in the main branch

This commit is contained in:
MDLeom 2022-01-11 07:10:55 +00:00
parent 502190afe1
commit fadd9ccf07
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,10 @@
image: node:lts-alpine
# Only run pipeline when scheduled or "Run pipeline" in the main branch
workflow:
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && ($CI_PIPELINE_SOURCE == "schedule" || $CI_PIPELINE_SOURCE == "web")'
build_job:
stage: build
@ -26,9 +31,6 @@ pages:
paths:
- public
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
cloudflare:
stage: deploy
@ -39,7 +41,7 @@ cloudflare:
- curl -X POST "https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/$CLOUDFLARE_BUILD_HOOK"
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CLOUDFLARE == "true"'
- if: '$CLOUDFLARE == "true"'
netlify:
stage: deploy
@ -54,4 +56,4 @@ netlify:
- netlify deploy --dir=public
rules:
- if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $NETLIFY == "true"'
- if: '$NETLIFY == "true"'