-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
76 lines (70 loc) · 2.44 KB
/
.travis.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
67
68
69
70
71
72
73
74
75
language: node_js
node_js:
- '16.17.0'
install:
# We use "force" because upstream dependency conflict isn't fixed
- "npm install --force"
env:
global:
- DEV_IMAGE_NAME=luckjs/ts-luck-ui-landing-page
- DEV_CONTAINER_NAME=luck-ui-landing-page_develop
- DEV_VIRTUAL_HOST=testdevelop.luck.org.pl
- PROD_IMAGE_NAME=luckjs/luck-ui-landing-page
- PROD_CONTAINER_NAME=luck-ui-landing-page_master
- PROD_VIRTUAL_HOST=luck.org.pl
jobs:
include:
- &build
stage: build
services:
- docker
script:
- docker build --build-arg VIRTUAL_HOST=$VIRTUAL_HOST --build-arg SHOULD_SHOW_DRAFT=$SHOULD_SHOW_DRAFT --build-arg TRACKING_ID=$TRACKING_ID --build-arg CLIENT_URL=$CLIENT_URL --build-arg CMS_USERNAME=$CMS_USERNAME --build-arg CMS_PASSWORD=$CMS_PASSWORD --build-arg ROLLBAR_ACESS_TOKEN=$ROLLBAR_ACESS_TOKEN --build-arg BANNER_ITEM_FACTORS=$BANNER_ITEM_FACTORS . -t $IMAGE_NAME
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push $IMAGE_NAME
if: branch = develop
env:
- IMAGE_NAME=$DEV_IMAGE_NAME
- SHOULD_SHOW_DRAFT=true
- VIRTUAL_HOST=$DEV_VIRTUAL_HOST
- <<: *build
if: branch = master OR tag =~ ^v.*$
env:
- IMAGE_NAME=$PROD_IMAGE_NAME
- SHOULD_SHOW_DRAFT=false
- VIRTUAL_HOST=$PROD_VIRTUAL_HOST
- &deploy
stage: deploy
before_deploy:
- openssl aes-256-cbc -K $encrypted_45457958fdd0_key -iv $encrypted_45457958fdd0_iv
-in .travis/id_rsa.enc -out .travis/id_rsa -d
- eval "$(ssh-agent -s)"
- cp .travis/id_rsa ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh-add ~/.ssh/id_rsa
- chmod 700 ~/.ssh
- ssh-keyscan $HOST_IP > ~/.ssh/known_hosts
script: skip
if: branch = develop
env:
- IMAGE_NAME=$DEV_IMAGE_NAME
- CONTAINER_NAME=$DEV_CONTAINER_NAME
- VIRTUAL_HOST=$DEV_VIRTUAL_HOST
deploy:
- provider: script
skip_cleanup: true
script: bash .travis/deploy.sh $HOST_IP $DOCKER_PASSWORD $DOCKER_USERNAME $IMAGE_NAME $CONTAINER_NAME
on:
branch: develop
- <<: *deploy
if: branch = master
env:
- IMAGE_NAME=$PROD_IMAGE_NAME
- CONTAINER_NAME=$PROD_CONTAINER_NAME
- VIRTUAL_HOST=$PROD_VIRTUAL_HOST
deploy:
- provider: script
skip_cleanup: true
script: bash .travis/deploy.sh $HOST_IP $DOCKER_PASSWORD $DOCKER_USERNAME $IMAGE_NAME $CONTAINER_NAME
on:
branch: master