-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathcloudbuild.yaml
36 lines (32 loc) · 1.52 KB
/
cloudbuild.yaml
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
steps:
- name: 'gcr.io/cloud-builders/docker'
id: create mongo
args: ['run', '-d', '--name=mongo-local', '--network=cloudbuild', 'mongo']
- id: Create Docker image
name: gcr.io/cloud-builders/docker
entrypoint: /bin/bash
args:
- -ceux
- |
./scripts/build/image $(grep version package.json | head -1 | tr -s ' ' | awk '{ print $2 }' | sed 's/[",]//g')
- id: Try running the tests
name: gcr.io/cloud-builders/docker
entrypoint: /bin/bash
args:
- -ceux
- |
docker run -d --name=warehouse -p 3000:3000 -e "MONGOLAB_URI=mongodb://mongo-local:27017/test" -e "NODE_ENV=staging" gcr.io/warehouse-build/warehouse:$(grep version package.json | head -1 | tr -s ' ' | awk '{ print $2 }' | sed 's/[",]//g')
- id: Deploy warehouse
name: gcr.io/cloud-builders/docker
entrypoint: /bin/bash
args:
- -ceux
- |
if [ "${BRANCH_NAME}" == "develop" ]; then
./scripts/deploy.sh $(grep version package.json | head -1 | tr -s ' ' | awk '{ print $2 }' | sed 's/[",]//g') $SHORT_SHA $BRANCH_NAME
elif [ "${BRANCH_NAME}" == "master" ]; then
./scripts/deploy.sh $(grep version package.json | head -1 | tr -s ' ' | awk '{ print $2 }' | sed 's/[",]//g') $SHORT_SHA $BRANCH_NAME
elif [[ "${BRANCH_NAME}" =~ ^release.* ]]; then
./scripts/deploy.sh $(grep version package.json | head -1 | tr -s ' ' | awk '{ print $2 }' | sed 's/[",]//g') $SHORT_SHA $BRANCH_NAME
fi
timeout: 12600s