summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 4092d7558729a4ea7a5ec384d08d94c639ffa4f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
image: alpine:latest

deploy:
  stage: deploy
  before_script:
    - 'command -v ssh-agent >/dev/null || ( apk add --update openssh )'
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts
    - chmod 644 ~/.ssh/known_hosts
  script:
    - ssh -p $SSH_PORT $SSH_USER@$SSH_HOST "cd repo && git stash && git pull --force origin master && rm -rf /var/www/yams.media/* && ./build.sh"
  only:
    - master