---
kind: pipeline
type: docker
name: build

steps:
  - name: docker
    image: plugins/docker
    settings:
      registry: docker.cybre.town
      repo: docker.cybre.town/adb/adb.sh
      tags:
        - "${DRONE_COMMIT_SHA:0:8}"
        - "latest"
      username:
        from_secret: docker_username
      password:
        from_secret: docker_password

---
kind: pipeline
type: docker
name: deploy

depends_on:
  - build

steps:
  - name: pull and deploy
    image: appleboy/drone-ssh:linux-amd64
    settings:
      host:
        from_secret: ssh_host
      username:
        from_secret: ssh_user_name
      key:
        from_secret: ssh_private_key
      script: |
        cd /media/docker/adb.sh
        docker compose -f docker-compose.prod.yml -p adb-sh pull -q
        docker compose -f docker-compose.prod.yml -p adb-sh up -d
