workflow:
  rules:
    - if: $CI_COMMIT_BRANCH

variables:
  PIP_CACHE_DIR: '$CI_PROJECT_DIR/.cache/pip'
  GIT_STRATEGY: clone

cache:
  key: $CI_COMMIT_SHORT_SHA
  paths:
    - _public/

run:
  stage: build
  image: node:latest
  script:
    - npm i -g @adguard/hostlist-compiler
    - hostlist-compiler -c tools/hostscompilerconf.json
      -o _public/blockrules.txt
    - hostlist-compiler -c tools/noise.json -o _public/noise.txt

pages:
  stage: deploy
  image: alpine:latest
  variables:
    GIT_STRATEGY: clone
  script:
    - mv _public public
    - ls -lha public/
    - head -n 15 public/blockrules.txt
    - head -n 15 public/noise.txt
  artifacts:
    paths:
      - public
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
