-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path.travis.yml
49 lines (43 loc) · 1.88 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
language: minimal
git:
depth: false
env:
global:
- IMG_NAME=daocasino/dicegamefront
- IMG_TAG=${TRAVIS_TAG:-${TRAVIS_BRANCH}-${TRAVIS_COMMIT:0:5}}
environments:
- &DEV_ENV
- AWS_DEFAULT_REGION=${DEV_AWS_REGION}
- AWS_ACCESS_KEY_ID=${DEV_AWS_ACCESS_KEY_ID}
- AWS_SECRET_ACCESS_KEY=${DEV_AWS_SECRET}
services:
- docker
before_script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
jobs:
include:
- stage: build & push
script:
- docker build -t $IMG_NAME:$IMG_TAG .
- docker push $IMG_NAME:$IMG_TAG
- |
if [[ "$TRAVIS_PULL_REQUEST" == "false" ]]; then #tag latest image for branch
if [[ "$TRAVIS_BRANCH" == "develop" || "$TRAVIS_BRANCH" == "stage" || "$TRAVIS_BRANCH" == "master" ]]; then
docker tag $IMG_NAME:$IMG_TAG $IMG_NAME:$TRAVIS_BRANCH
docker push $IMG_NAME:$TRAVIS_BRANCH
fi
fi
- stage: deploy
env:
- *DEV_ENV
script:
|
if [[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "develop" ]]; then
docker run -e AWS_DEFAULT_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY silintl/ecs-deploy -t 300 -c platform-dev -n dice-game-dev -i $IMG_NAME:$IMG_TAG --skip-deployments-check
elif
[[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "stage" ]]; then
docker run -e AWS_DEFAULT_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY silintl/ecs-deploy -t 300 -c platform-stage -n dice-game-stage -i $IMG_NAME:$IMG_TAG --skip-deployments-check
elif
[[ "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]]; then
docker run -e AWS_DEFAULT_REGION -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY silintl/ecs-deploy -t 300 -c platform-prod -n dice-game-prod -i $IMG_NAME:$IMG_TAG --skip-deployments-check
fi