language: node_js
node_js:
  - "14.16"

jobs:
  include:
    - stage: NPM RC Release
      if: tag =~ /-(rc|RC)/
      node_js: "14.16"
      script:
        - npm install
        - npm run build
        - echo "Deploying RC to NPM..."
      deploy:
        provider: npm
        email: $NPM_EMAIL
        api_key: $NPM_API_KEY
        tag: next
    - stage: NPM Release
      if: not tag =~ /-(rc|RC)/
      node_js: "14.16"
      script:
        - npm install
        - npm run build
        - echo "Deploying to NPM..."
      deploy:
        provider: npm
        email: $NPM_EMAIL
        api_key: $NPM_API_KEY
        skip_cleanup: true
        on:
          tags: true
