-
-
Save bitkidd/0b4767d6d7fa8a62af02c97909f01d11 to your computer and use it in GitHub Desktop.
GitLab.com + GitLab-CI + Shared runners + gulp + rsyncで自動デプロイ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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