image: node:latest

stages:
  - install
  - pages
  - test
  - publish

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

install_dependencies:
  stage: install
  script: npm install
  artifacts:
    paths:
      - node_modules/

pages:
  stage: pages
  script:
    - npm run docs
  artifacts:
    paths:
      - public/
  only:
    - master

test:
  stage: test
  script:
    - npm run test

store_publish:
  stage: publish
  script:
    - npm run build
    ## see: https://github.com/MobileFirstLLC/cws-publish
    # - npx cws-upload $client_id $secret $token $zip_path $extension_id;
  artifacts:
    paths:
      - $zip
  only:
    - tags
