pup-filter/.gitlab-ci.yml

76 lines
1.4 KiB
YAML
Raw Normal View History

2022-01-25 10:12:53 +00:00
image: node:lts-alpine
2021-03-31 10:53:42 +00:00
include:
- template: Security/Secret-Detection.gitlab-ci.yml
# 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")'
2021-03-31 10:53:42 +00:00
build_job:
stage: build
2021-03-31 10:53:42 +00:00
before_script:
2022-11-20 01:42:21 +00:00
- apk update && apk add brotli curl grep jq xmlstarlet
2021-03-31 10:53:42 +00:00
script:
- sh src/script.sh
- find public -type f -regex '.*\.\(txt\|conf\|tpl\|rules\)$' -exec gzip -f -k -9 {} \;
- find public -type f -regex '.*\.\(txt\|conf\|tpl\|rules\)$' -exec brotli -f -k -9 {} \;
2021-03-31 10:53:42 +00:00
artifacts:
paths:
- tmp
- public
expire_in: 1 week
2021-03-31 10:53:42 +00:00
pages:
stage: deploy
2021-03-31 10:53:42 +00:00
dependencies:
- build_job
2021-03-31 10:53:42 +00:00
script:
- echo
2021-03-31 10:53:42 +00:00
artifacts:
paths:
- public
expire_in: 1 week
2021-03-31 10:53:42 +00:00
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
cloudflare:
stage: deploy
before_script:
2022-11-20 01:42:21 +00:00
- apk update && apk add curl
script:
- curl -X POST "https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/$CLOUDFLARE_BUILD_HOOK"
rules:
2022-01-25 10:12:53 +00:00
- if: $CLOUDFLARE_BUILD_HOOK
netlify:
stage: deploy
dependencies:
- build_job
before_script:
- npm install netlify-cli -g
- netlify --telemetry-disable
script:
- netlify deploy --dir=public --prod
2022-01-26 04:20:59 +00:00
cache:
paths:
- node_modules/
rules:
2022-01-25 10:12:53 +00:00
- if: $NETLIFY_SITE_ID