Skip to content

Instantly share code, notes, and snippets.

@bitkidd
Forked from comilab/.gitlab-ci.yml
Created July 27, 2017 15:23
Show Gist options
  • Save bitkidd/0b4767d6d7fa8a62af02c97909f01d11 to your computer and use it in GitHub Desktop.
Save bitkidd/0b4767d6d7fa8a62af02c97909f01d11 to your computer and use it in GitHub Desktop.

Revisions

  1. @comilab comilab created this gist Sep 13, 2016.
    29 changes: 29 additions & 0 deletions .gitlab-ci.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    image: node:latest

    cache:
    paths:
    - node_modules/

    before_script:
    - apt-get update -y
    - apt-get install rsync openssh-client -y
    - npm install

    stages:
    - deploy

    job_deploy:
    stage: deploy
    environment: production
    only:
    - master
    script:
    - npm run build
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$SSH_PRIVATE_KEY")
    - mkdir -p ~/.ssh
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
    - rsync -avz --delete ./public "${SERVER_USER}@${SERVER_HOST}:${SERVER_DEST}"
    artifacts:
    paths:
    - public