stages:
  - staging

staging:
  stage: staging
  environment:
    name: 'staging'
  only: 
    - develop
  script:
    # Add RSA Keys for connecting to host
    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$SSH_PRIVATE_KEY_TEST")
    - mkdir -p ~/.ssh
    - echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
    - ssh-keyscan -H 'gitlab.com' >> ~/.ssh/known_hosts
    # Execute set of commands for deploying changes to host
    - ssh $SSH_HOST_TEST "cd $VH_PATH_TEST && rm -fr vendor && git checkout develop && git pull origin develop && composer install"
    - exit

