-
Notifications
You must be signed in to change notification settings - Fork 13
/
.travis.yml
68 lines (68 loc) · 2.49 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
dist: jammy
language: node_js
addons:
chrome: stable
branches:
only:
- develop
- staging
- prod
env:
global:
- REPO_NAME="${PWD##*/}"
- AWS_REGION="us-east-1"
install:
# install awscli v2
- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- unzip awscliv2.zip && sudo ./aws/install
# install other tools
- pip install travis-wait-improved awsebcli
before_script:
# Setup AWS CLI profile for multiple AWS accounts
- mkdir -p ~/.aws
- echo -e "[profile develop]\nsource_profile=ci-user-develop\nrole_arn=${AwsCfServiceRoleArn_develop}\n" > ~/.aws/config
- echo -e "[ci-user-develop]\naws_access_key_id=${AwsTravisAccessKey_develop}\naws_secret_access_key=${AwsTravisSecretAccessKey_develop}\n" > ~/.aws/credentials
- echo -e "[profile prod]\nsource_profile=ci-user-prod\nrole_arn=${AwsCfServiceRoleArn_prod}\n" >> ~/.aws/config
- echo -e "[ci-user-prod]\naws_access_key_id=${AwsTravisAccessKey_prod}\naws_secret_access_key=${AwsTravisSecretAccessKey_prod}\n" >> ~/.aws/credentials
# setup npm dependencies
- npm install
stages:
- name: test
- name: eb-deploy-develop
- name: eb-deploy-staging
- name: eb-deploy-prod
jobs:
fast_finish: true
include:
- stage: test
node_js: 16.15.0
script:
- npm run test
- npm run build
- stage: deploy-develop
if: (NOT type IN (pull_request)) AND (branch = develop)
node_js: 16.15.0
script:
- npm run ci:build:develop
- npm run ci:clean
- ./scripts/set-agora-version.sh || travis_terminate 1
- zip /tmp/agora-app.zip -qr9 * .[^.]*
- eb deploy --profile develop --verbose --region ${AWS_REGION} --timeout 15 --staged agora-develop
- stage: deploy-staging
if: (NOT type IN (pull_request)) AND (branch = staging)
node_js: 16.15.0
script:
- npm run ci:build:staging
- npm run ci:clean
- ./scripts/set-agora-version.sh || travis_terminate 1
- zip /tmp/agora-app.zip -qr9 * .[^.]*
- eb deploy --profile prod --verbose --region ${AWS_REGION} --timeout 15 --staged agora-staging
- stage: deploy-prod
if: (NOT type IN (pull_request)) AND (branch = prod)
node_js: 16.15.0
script:
- npm run ci:build:prod
- npm run ci:clean
- ./scripts/set-agora-version.sh || travis_terminate 1
- zip /tmp/agora-app.zip -qr9 * .[^.]*
- eb deploy --profile prod --verbose --region ${AWS_REGION} --timeout 15 --staged agora-prod