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