---
  image: node:14
  
  stages:
    - release
  
  publish:
    stage: release
    before_script:
      - npm install -g semantic-release@v17 @semantic-release/gitlab@v6.0.5
      - git checkout $CI_COMMIT_REF_NAME
      - npm ci --cache .npm --prefer-offline
    script:
      - echo "const path = \"https://cdn.skypack.dev/@startinblox/component-chat@$(semantic-release --dry-run | grep -oP 'Published release \K.*? ' | sed 's/ *$//g')\";module.exports = path;" > src/path.js
      - npm run build
      - semantic-release
    only:
      - master
      - beta
    tags:
      - deploy