---
include:
  - remote: https://jobs.just-ci.dev/workflow/cd/ssh/ssh.yml
  - remote: https://jobs.just-ci.dev/workflow/cd/ssh/docker-login.yml
  - remote: https://jobs.just-ci.dev/workflow/cd/ssh/make.yml
  - remote: https://jobs.just-ci.dev/workflow/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
