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 blintmester@centaur.sch.bme.hu cp /afs/sch.bme.hu/home/blintmester/.system/blintmester.keytab /tmp/blintmester.keytab
    - ssh blintmester@centaur.sch.bme.hu kinit -k -t /tmp/blintmester.keytab blintmester
    - ssh blintmester@centaur.sch.bme.hu rm /tmp/blintmester.keytab
    - ssh blintmester@centaur.sch.bme.hu aklog sch.bme.hu -k SCH.BME.HU
    - ssh blintmester@centaur.sch.bme.hu mkdir -p /home/blintmester/public_html/git
    # actual work
    - scp -r $PWD/* blintmester@centaur.sch.bme.hu:/home/blintmester/public_html/git/
  only:
    refs:
      - master
