Skip to content
Snippets Groups Projects
.gitlab-ci.yml 946 B
---
## /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 expandtab smarttab autoindent: */
default:
  image: 'node:12.16.1'
  cache:
    paths:
      - 'node_modules/'

stages:
  - build
  - test
  - deploy

build:
  stage: build
  rules:
    - if: '$CI_COMMIT_TAG != null'
      when: always
    - if: '$CI_MERGE_REQUEST_ID != null'
      when: always
  artifacts:
    paths:
      - 'node_modules/'
      - 'dist/'
      - 'www/'
    untracked: true
  script:
    - yarn "install" --immutable

test:
  stage: test
  rules:
    - if: '$CI_COMMIT_TAG != null'
      when: on_success
    - if: '$CI_MERGE_REQUEST_ID != null'
      when: on_success
  script:
    - yarn "test"

deploy_npm:
  stage: deploy
  rules:
    - if: '$CI_COMMIT_TAG != null'
      when: on_success
  before_script:
    ## Configure NPM with our token
    - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >"${HOME}/.npmrc"
  script:
    - npm "publish" --access public