Skip to content

Instantly share code, notes, and snippets.

@comilab
Created September 13, 2016 20:19
Show Gist options
  • Save comilab/06ac9f3daddd7d3cac6a309564aa9761 to your computer and use it in GitHub Desktop.
Save comilab/06ac9f3daddd7d3cac6a309564aa9761 to your computer and use it in GitHub Desktop.
GitLab.com + GitLab-CI + Shared runners + gulp + rsyncで自動デプロイ
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment