/
.travis.yml
79 lines (68 loc) · 2.2 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
---
language: node_js
node_js:
- "10"
sudo: required
cache:
yarn: true
before_install:
- set -e
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
AWS_BUCKET="search.ror.community";
CLOUDFRONT_DISTRIBUTION_ID=$CLOUDFRONT_DISTRIBUTION_ID;
cp .env.production .env;
AUTO_DEPLOY=true;
elif [[ "$TRAVIS_BRANCH" == "dev" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
AWS_BUCKET="search.dev.ror.community";
CLOUDFRONT_DISTRIBUTION_ID=$CLOUDFRONT_DISTRIBUTION_DEV_ID;
cp .env.dev .env;
AUTO_DEPLOY=true;
else
AWS_BUCKET="search.ror.community";
CLOUDFRONT_DISTRIBUTION_ID=$CLOUDFRONT_DISTRIBUTION_ID;
cp .env.production .env;
fi
- npm config set spin false
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH=$HOME/.yarn/bin:$PATH
install:
- yarn install --non-interactive
- sudo pip install awscli
- curl -sL https://sentry.io/get-cli/ | bash
- sentry-cli --version
script:
- yarn test
- ember build --environment=production
after_success:
# Send release information to Sentry
- if [ "$AUTO_DEPLOY" == "true" ]; then
GIT_TAG=$(git describe --tags $(git rev-list --tags --max-count=1));
sentry-cli releases new ror-app:${GIT_TAG} --finalize --project ror-app;
if [ "$TRAVIS_BRANCH" == "master" ]; then
sentry-cli releases deploys ror-app:${GIT_TAG} new -e production;
else
sentry-cli releases deploys ror-app:${GIT_TAG} new -e dev;
fi
sentry-cli releases set-commits --auto ror-app:${GIT_TAG};
fi
deploy:
provider: s3
access_key_id: $AWS_ACCESS_KEY
secret_access_key: $AWS_SECRET_KEY
bucket: $AWS_BUCKET
region: eu-west-1
skip_cleanup: true
local_dir: dist
acl: public_read
cache_control: "no-cache"
on:
all_branches: true
after_deploy:
- export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY
- export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KEY
# Allow `awscli` to make requests to CloudFront.
- aws configure set preview.cloudfront true
# Invalidate every object in the targeted distribution.
- aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"
notifications:
email: false