image: kroniak/ssh-client

stages:
  - deploy

home:
  stage: deploy
  before_script:
    - eval $(ssh-agent -s)
    - echo "$SSH" | tr -d '\r' | ssh-add -
    - mkdir -p ~/.ssh/socket
    - chmod 700 ~/.ssh
    - cp .magic_ssh_config ~/.ssh/config
  script:
    # AFS magic incoming
    - ssh rlacko@centaur.sch.bme.hu cp /afs/sch.bme.hu/home/rlacko/.system/rlacko.keytab /tmp/rlacko.keytab
    - ssh rlacko@centaur.sch.bme.hu kinit -k -t /tmp/rlacko.keytab rlacko
    - ssh rlacko@centaur.sch.bme.hu rm /tmp/rlacko.keytab
    - ssh rlacko@centaur.sch.bme.hu aklog sch.bme.hu -k SCH.BME.HU
    - ssh rlacko@centaur.sch.bme.hu mkdir -p /home/rlacko/public_html/git
    # actual work
    - scp -r $PWD/* rlacko@centaur.sch.bme.hu:/home/rlacko/public_html/git/
  only:
    refs:
      - master
