-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbitbucket-pipelines.yml
125 lines (121 loc) · 4.52 KB
/
bitbucket-pipelines.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# This is a sample build configuration for JavaScript.
# Check our guides at https://confluence.atlassian.com/x/14UWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: node:8.10
# Test manually
# sudo docker run -it --volume=/home/dev/Documents/Git/workonblockchain.com:/workonblockchain.com --workdir="/workonblockchain.com" --memory=4g --memory-swap=4g --memory-swappiness=0 --entrypoint=/bin/bash node:8.10
pipelines:
branches:
staging:
- step:
name: "Run server unit tests"
caches:
- node
script:
- cd server
- npm install
- npm run-script test-all
services:
- mongo
- step:
name: "Build client and server distributions"
script:
- . ./scripts/git.sh staging
- cd client
- npm install
- npm run build:serverless:staging
- echo $CLIENT_VERSION_FILE > "dist/version"
- cd ../server
- echo $SERVER_VERSION_FILE > "config/version.json"
- apt-get update
- apt-get install zip -y
- zip -r $SERVER_ZIP_FILE *
artifacts:
- client/**
- server/*.zip
- parallel:
- step:
name: "Deploy client to staging"
deployment: staging
script:
- cd client
- npm install -g serverless
- serverless config credentials --provider aws --key $AWS_ACCESS_KEY_ID --secret $AWS_SECRET_ACCESS_KEY
- serverless deploy --stage staging
- step:
name: "Deploy server to staging"
script:
- . ./scripts/git.sh staging
- cd server
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.1
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: "eu-west-1"
APPLICATION_NAME: "staging.workonblockchain.com"
ZIP_FILE: $SERVER_ZIP_FILE
S3_BUCKET: "elasticbeanstalk-eu-west-1-831241436261"
VERSION_LABEL: $SERVER_VERSION
ENVIRONMENT_NAME: "staging-api-workonblockchain-com"
master:
- step:
name: "Run server unit tests"
caches:
- node
script:
- cd server
- npm install
- npm run-script test-all
services:
- mongo
- step:
name: "Build client and server distributions"
script:
- . ./scripts/git.sh production
- cd client
- npm install
- npm run build:serverless:prod
- echo $CLIENT_VERSION_FILE > "dist/version"
- cd ../server
- echo $SERVER_VERSION_FILE > "config/version.json"
- apt-get update
- apt-get install zip -y
- zip -r $SERVER_ZIP_FILE *
artifacts:
- client/**
- server/*.zip
- parallel:
- step:
name: "Deploy client to production"
deployment: production
script:
- cd client
- npm install -g serverless
- serverless config credentials --provider aws --key $AWS_ACCESS_KEY_ID --secret $AWS_SECRET_ACCESS_KEY
- serverless deploy --stage production
- . ../scripts/aws-install.sh
- aws cloudfront create-invalidation --distribution-id E13O7UFUMVSIRZ --paths "/*"
- aws cloudfront create-invalidation --distribution-id E32QBMZ6U0Z8AV --paths "/*"
- step:
name: "Deploy server to production"
script:
- . ./scripts/git.sh production
- cd server
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.2.1
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: "eu-west-1"
APPLICATION_NAME: "production.workonblockchain.com"
ZIP_FILE: $SERVER_ZIP_FILE
S3_BUCKET: "elasticbeanstalk-eu-west-1-831241436261"
VERSION_LABEL: $SERVER_VERSION
ENVIRONMENT_NAME: "production-api-workonblockchain-com"
options:
max-time: 20
definitions:
services:
mongo:
image: mongo:3.6.8