kind: pipeline
type: docker
name: default

steps:
  - name: deploy
    image: appleboy/drone-ssh
    settings:
      host:
        - 148.135.109.242
      username: root
      key:
        from_secret: ssh_key
      passphrase:
        from_secret: ssh_passphrase
      port: 22
      command_timeout: 2m
      script:
        - echo "Go to the project directory"
        - cd /root/develop/discord-dota-bot
        - echo "Pull the latest code"
        - git pull
        - echo "Restart service"
        - supervisorctl restart dotabot
      script_stop: true
    when:
      event:
      - push

  - name: discord notification
    image: appleboy/drone-discord
    settings:
      webhook_id:
        from_secret: discord_webhook_id
      webhook_token:
        from_secret: discord_webhook_token
      # message: |
      #   Drone Build #${DRONE_BUILD_NUMBER} ${DRONE_BUILD_STATUS}
      #   Project: ${DRONE_REPO_NAME}
      #   Branch: ${DRONE_BRANCH}
      #   Commit: ${DRONE_COMMIT_SHA:0:8}
      #   [Build Log](${DRONE_BUILD_LINK})
    when:
      status: [success, failure]
      event:
      - push


volumes:
  - name: dockersock
    host:
      path: /var/run/docker.sock
