-
Notifications
You must be signed in to change notification settings - Fork 5
/
.travis.yml
88 lines (82 loc) · 2.31 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
76
77
78
79
80
81
82
83
84
85
86
87
88
language: node_js
node_js:
- '10.16.3'
before_install:
- pip install --user awscli
- export PATH=$PATH:$HOME/.local/bin
- |
if [ $TRAVIS_BRANCH == "master" ] && [ $IS_CONTENTFUL == "yes" ]; then
echo "is from contentful"
eval export CLOUDFRONT_DISTRIBUTION="$PROD_CLOUDFRONT_DISTRIBUTION"
elif [ $TRAVIS_BRANCH == "master" ]; then
echo "is from master"
eval export CLOUDFRONT_DISTRIBUTION="$PROD_CLOUDFRONT_DISTRIBUTION"
elif [ $TRAVIS_TAG ]; then
echo "has tag"
eval export CLOUDFRONT_DISTRIBUTION="$DEMO_CLOUDFRONT_DISTRIBUTION"
elif [ $TRAVIS_BRANCH == "dev" ]; then
echo "is from dev"
eval export CLOUDFRONT_DISTRIBUTION="$DEV_CLOUDFRONT_DISTRIBUTION"
fi
- echo $CLOUDFRONT_DISTRIBUTION
- echo $TRAVIS_BRANCH
- echo $IS_CONTENTFUL
- echo IS_CONTENTFUL
cache: yarn
script:
- yarn
- yarn run lint
- |
cat > .env.production << EOF
CONTENTFUL_SPACE_ID='`$CONTENTFUL_SPACE_ID`'
CONTENTFUL_ACCESS_TOKEN='`$CONTENTFUL_ACCESS_TOKEN`'
COGNITO_APP_CLIENT_ID='`$COGNITO_APP_CLIENT_ID`'
EOF
- yarn run build
deploy:
- provider: s3
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
bucket: $PROD_S3_BUCKET
acl: public_read
local_dir: 'public'
skip_cleanup: true
region: 'eu-central-1'
on:
branch: master
- provider: s3
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
bucket: $STAGING_S3_BUCKET
acl: public_read
local_dir: 'public'
skip_cleanup: true
region: 'eu-central-1'
on:
branch: master
condition: $IS_CONTENTFUL=yes
- provider: s3
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
bucket: $DEV_S3_BUCKET
acl: public_read
local_dir: 'public'
skip_cleanup: true
region: 'eu-central-1'
on:
branch: dev
tags: false
- provider: s3
access_key_id: $AWS_ACCESS_KEY_ID
secret_access_key: $AWS_SECRET_ACCESS_KEY
bucket: $DEMO_S3_BUCKET
acl: public_read
local_dir: 'public'
skip_cleanup: true
region: 'eu-central-1'
on:
all_branches: true
tags: true
after_deploy:
- aws configure set preview.cloudfront true
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION --paths "/*"