---
include:
  - remote: https://jobs.just-ci.dev/v6.5.0/cd/ssh/ssh.yml
  - remote: https://jobs.just-ci.dev/v6.5.0/cd/ssh/docker-login.yml
  - remote: https://jobs.just-ci.dev/v6.5.0/cd/ssh/make.yml
  - remote: https://jobs.just-ci.dev/v6.5.0/cd/ssh/scp.yml

variables:
  REMOTE_USER: ubuntu
  REMOTE_HOST: x.x.x.x
  SCP_REMOTE_DEST_DIR: /home/ubuntu

stages:
  - deliver
  - configure
  - deploy

scp:
  stage: deliver

docker:login:
  stage: configure

deploy:make:
  stage: deploy

.ssh:
  rules:
    - if: $CI_COMMIT_TAG
      when: never
    - if: $CI_COMMIT_REF_PROTECTED
      variables:
        MAKE_EXTRA_ARGS: DEPLOYED_BRANCH=$CI_COMMIT_REF
