kind: pipeline
type: docker
name: Verify business rules

steps:
  - name: verify business rules
    image: node
    commands:
      - echo "Checking merge ->"
      # - sleep 1m
trigger:
  ref:
    - refs/pull-requests/*/from
    - refs/heads/feature/**
    - refs/heads/hotfix/**
    - refs/heads/bugfix/**
---
kind: pipeline
type: docker
name: Bump Version

steps:
  - name: npm patch version
    image: node
    commands:
      - export MSG="${DRONE_COMMIT_MESSAGE/\#/}"
      - export PATTERN='[CI SKIP]'
      - if echo "$MSG" | grep -Fq "$(echo $PATTERN)" ; then echo "Pattern found in message"; else npm version patch -m "%s [CI SKIP]"; git push origin --tags; git push origin develop; fi
    environment:
      GIT_AUTHOR_NAME: GIT ADMIN
      GIT_AUTHOR_EMAIL: git.admin@plus.pl
      GIT_COMMITTER_NAME: GIT ADMIN
      GIT_COMMITTER_EMAIL: git.admin@plus.pl
trigger:
  branch:
    - develop
  event:
    include:
      - push
---
kind: pipeline
type: docker
name: Build image

steps:
  - name: npm install
    image: node
    commands:
      - npm install
  - name: npm build
    image: node
    commands:
      - npm run-script build
  - name: tag app
    image: node
    commands:
      - >-
        PACKAGE_VERSION=$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
      - echo $PACKAGE_VERSION
      - echo $PACKAGE_VERSION > .tags
      - cat .tags
  - name: publish package
    image: node
    commands:
      - npm publish
trigger:
  event:
    include:
      - tag







