pipeline:
  build:
    image: kkarczmarczyk/node-yarn
    commands:
      - yarn
      - yarn test
  publish-staging:
    image: plugins/docker
    repo: nossas/bonde-client
    username: lpirola
    password: ${DOCKER_PASSWORD}
    tags:
      - ${DRONE_BRANCH}
    when:
      status: success
      branch: /(hotfix|release|feature)(-|\/).*/
  deploy-staging:
    image: appleboy/drone-ssh
    host: reboo-staging.org
    username: ubuntu
    port: 22
    script:
      - sudo docker pull nossas/bonde-client:${DRONE_BRANCH}
      - sudo docker tag nossas/bonde-client:${DRONE_BRANCH} dokku/bonde-client:${DRONE_BRANCH}
      - dokku tags:deploy bonde-client ${DRONE_BRANCH}
    when:
      status: success
      branch: /(hotfix|release|feature)(-|\/).*/
  notify:
    image: plugins/slack
    webhook: https://hooks.slack.com/services/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
    channel: n_tech
    username: CI - ${DRONE_REPO_NAME}
    when:
      event: [ push, tag, build, publish, deployment, pull_request ]
      status: [ success, failure ]

pipeline:
  build:
    image: kkarczmarczyk/node-yarn
    commands:
      - yarn
      - yarn test
  publish-staging:
    image: plugins/docker
    repo: nossas/bonde-client
    username: lpirola
    password: ${DOCKER_PASSWORD}
    tags:
      - ${DRONE_BRANCH}
    when:
      status: success
      branch: [hotfix-*, release-*, feature-*, develop]
  deploy-staging:
    image: appleboy/drone-ssh
    host: reboo-staging.org
    username: ubuntu
    port: 22
    script:
      - sudo docker pull nossas/bonde-client:${DRONE_BRANCH}
      - sudo docker tag nossas/bonde-client:${DRONE_BRANCH} dokku/bonde-client:${DRONE_BRANCH}
      - dokku tags:deploy bonde-client ${DRONE_BRANCH}
    when:
      status: success
      branch: [hotfix-*, release-*, feature-*, develop]
  notify:
    image: plugins/slack
    webhook: https://hooks.slack.com/services/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
    channel: n_tech
    username: CI - ${DRONE_REPO_NAME}
    when:
      event: [ push, tag, build, publish, deployment, pull_request ]
      status: [ success, failure ]

Fix when ci plugin is fired
Fix when ci plugin is fired
