---
kind: pipeline
name: deploy to swarm.autonomic.zone
steps:
  - name: bundle static
    image: plugins/docker
    settings:
      username: 3wordchant
      password:
        from_secret: git_coopcloud_tech_token_3wc
      repo: git.coopcloud.tech/coop-cloud/coopcloud.tech
      tags: latest
      registry: git.coopcloud.tech

  - name: deployment
    image: git.coopcloud.tech/coop-cloud/stack-ssh-deploy:latest
    settings:
      stack: coop_cloud_site
      host: swarm-0.coopcloud.tech
      deploy_key:
        from_secret: drone_ssh_swarm-0_coopcloud_tech
    depends_on:
      - bundle static

  - name: notify coopcloud-dev on failure
    image: plugins/matrix
    settings:
      homeserver: https://matrix.autonomic.zone
      roomid: "IFazIpLtxiScqbHqoa:autonomic.zone"
      userid: "@autono-bot:autonomic.zone"
      accesstoken:
        from_secret: autono_bot_access_token
    depends_on:
      - bundle static
      - deployment
    when:
      status:
        - failure
trigger:
  branch:
    - main
