when:
  - event: push
    branch: master

steps:
  - name: build
    image: local/builder

    commands:
      - npm install
      - npm run build
      - mkdir /root/.ssh && chmod 0700 /root/.ssh
      - echo $SSH_KEY | base64 --decode >> /root/.ssh/id_rsa
      - chmod 0600 /root/.ssh/id_rsa
      - ssh-keyscan $REMOTE_IP >> /root/.ssh/known_hosts
      - /bin/rsync -avzh ./dist ansible@$REMOTE_IP:/var/www/polsevev/
    secrets: [ SSH_KEY, remote_ip ]
