-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
45 lines (41 loc) · 1.17 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# base image
image: "ruby:2.4.1"
# build stages
stages:
- staging
- production
# cache gems in between builds
cache:
paths:
- vendor/ruby
- node_modules
deploy_to_staging:
stage: staging
only:
- develop
before_script:
- gem install bundler -v 1.13.7 --no-ri --no-rdoc
- bundle install -j $(nproc) --path vendor
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- 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'
environment: staging
script:
- cap staging deploy
deploy_to_production:
stage: production
only:
- master
before_script:
- gem install bundler -v 1.13.7 --no-ri --no-rdoc
- bundle install -j $(nproc) --path vendor
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- 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'
environment: production
script:
- cap production deploy