image: python:3

stages:
  - generate
  - deploy

before_script:
  - pip3 install -r requirements.txt

generate:
  stage: generate
  script:
    - make art
  artifacts:
    paths:
      - output/
  only:
    - master

deploy:
  stage: deploy
  script:
    - mkdir -p $HOME/.ssh
    - chmod 700 $HOME/.ssh
    - eval $(ssh-agent -s)
    - echo "$GITLAB_DEPLOY" | tr -d '\r' > $HOME/.ssh/id_rsa
    - chmod 700 $HOME/.ssh/id_rsa
    - ssh-keyscan wozard-assets.vereto.net >> $HOME/.ssh/known_hosts
    - chmod 644 $HOME/.ssh/known_hosts
    - scp -r output/* deploy@wozard-assets.vereto.net:/home/deploy/wozard-assets.vereto.net/cards/front/
  dependencies:
    - generate
  only:
    - master