kind: pipeline
type: docker
name: server
steps:
  - name: build
    image: appleboy/drone-ssh
    settings:
      host:
        - 172.10.10.10
      username: eigen
      key:
        from_secret: DEVOPS_SSH_PRIVATE_OPEN
      port: 22
      script:
        - cd /home/eigen/PROJECT/POS/POS.DEV/BE
        - sh build.sh
    when:
      ref:
        - refs/tags/devel_*
        - refs/tags/*-alpha.*
  - name: build-production
    image: plugins/docker
    settings:
      registry: registry.eigen.co.id
      repo: registry.eigen.co.id/eigen/${DRONE_REPO_NAME}
      build_args:
        - env_target=env.production
      tags: ${DRONE_TAG}
      custom_dns: 172.10.10.16
    when:
      ref:
        - refs/tags/*-production.*
  - name: send-message
    image: plugins/webhook
    settings:
      urls: https://mattermost.eigen.co.id/api/v4/posts
      content_type: application/json
      headers:
        - Authorization=Bearer 5zubexudb38uuradfa36qy98ca
      template: |
        {
          "channel_id": "s1ekqde1c3du5p35g6budnuotc",
          "message": "Build {{repo.name}} sudah selesai"
        }
trigger:
  event:
    exclude:
      - promote
