-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
66 lines (60 loc) · 1.96 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
image: docker:git
services:
- docker:dind
stages:
- qa-vps
- staging-heroku
- production-heroku
staging-heroku:
stage: staging-heroku
image: ruby:latest
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=$HEROKU_APP_STAGING --api-key=$HEROKU_API_KEY
when: manual
production-heroku:
stage: production-heroku
image: ruby:latest
script:
- apt-get update -qy
- apt-get install -y ruby-dev
- gem install dpl
- dpl --provider=heroku --app=$HEROKU_APP_PRODUCTION --api-key=$HEROKU_API_KEY
when: manual
qa-vps-build-push:
stage: qa-vps
script:
- export APP_VERSION="`cat "version.txt"`"
- apk add --no-cache --update python3 py3-pip gcc libpq-dev python3-dev musl-dev cairo-dev
- pip install pipenv
- pipenv install
- sh scripts/docker_build.sh "$APP_VERSION"
- sh scripts/docker_push.sh "$DOCKER_ACCOUNT" "$DOCKER_PASSWORD" "$APP_VERSION"
when: manual
qa-vps-deploy:
stage: qa-vps
script:
- export APP_VERSION="`cat "version.txt"`"
- echo $APP_VERSION
# -
- apk add --update rsync
# -
- 'command -v ssh-agent >/dev/null || ( apk add --update openssh-client )'
- eval $(ssh-agent -s)
- echo "$VPS_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p /root/.ssh
- chmod 700 /root/.ssh
# -
- export LOCAL_PRIVATE_KEY_PATH="/root/.ssh/id_rsa_${VPS_USER}_${VPS_NAME}"
- echo "$VPS_PRIVATE_KEY" | tr -d '\r' > tmp_ppk
- cp tmp_ppk "$LOCAL_PRIVATE_KEY_PATH"
- chmod 700 "$LOCAL_PRIVATE_KEY_PATH"
- ls -lah /root/.ssh
# -
- sh scripts/vps/deploy_to_vps.sh "$APP_VERSION" "$VPS_USER" "$VPS_NAME" "$VPS_PORT" "$LOCAL_PRIVATE_KEY_PATH"
when: manual
# tags:
# # If there's a need to use our own gitlab runner:
# - fynapp-runner