Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.06 KiB
Newer Older
---
## /* vim: set tabstop=2 softtabstop=2 shiftwidth=2 expandtab smarttab autoindent: */
  image: "node:12.16.1"
  cache:
    paths:
      - "node_modules/"

stages:
  - build
  - test
  - deploy

  stage: build
  rules:
Mira Manninen's avatar
Mira Manninen committed
    - if: '$CI_COMMIT_BRANCH == "master"'
Mira Manninen's avatar
Mira Manninen committed
    - if: '$CI_COMMIT_TAG != null'
      when: always
    - if: '$CI_MERGE_REQUEST_ID != null'
      when: always
  artifacts:
    paths:
      - "node_modules/"
      - "dist/"
      - "www/"
    untracked: true
  script:
Mira Manninen's avatar
Mira Manninen committed
    - env
    - yarn "install" --immutable

test:
  stage: test
  rules:
    - if: '$CI_COMMIT_BRANCH == "master" && $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_BRANCH == "master" && $CI_COMMIT_TAG != null'
      when: on_success
  before_script:
    ## Configure NPM with our token
    - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >"${HOME}/.npmrc"
    - npm "publish" --access public