image: node:alpine

cache:
  key: "${CI_COMMIT_REF_SLUG}"
  paths:
    - node_modules/
    - build/

stages:
  - install
  - build

install_dependencies:
  stage: install
  script:
    - npm ci
  cache:
        key: ${CI_COMMIT_REF_SLUG}
        paths:
            - node_modules/
        policy: push

build_project:
  stage: build
  script:
    - npm ci
    - npm run build
  dependencies:
    - install_dependencies
  cache:
    key: "${CI_COMMIT_REF_SLUG}"
    paths:
      - node_modules/
    policy: pull
