-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
57 lines (57 loc) · 1.92 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
env:
global:
- MONGO_CONN_STRING=mongodb+srv://dbadmin:SZARo4oZEL1gIHEZ@cluster0.lgzom.mongodb.net/testing?retryWrites=true&w=majority
language: node_js
node_js:
- "15"
services:
- docker
# cache:
# directories:
# - backend/node_modules
before_install:
- cd backend
install:
- npm install
script:
- MONGO_CONN_STRING="mongodb+srv://dbadmin:SZARo4oZEL1gIHEZ@cluster0.lgzom.mongodb.net/testing?retryWrites=true&w=majority" npm test
- cd ..
after_success:
- |
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
echo "We're not on the master branch"
exit 0
fi
docker build -t registry.heroku.com/unibuk/web app
docker build -t registry.heroku.com/unibuk-backend/web backend
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin registry.heroku.com
docker push registry.heroku.com/unibuk/web
docker push registry.heroku.com/unibuk-backend/web
YOUR_HEROKU_APP=unibuk-backend
DOCKER_IMAGE_ID=$(docker inspect registry.heroku.com/$YOUR_HEROKU_APP/web --format={{.Id}})
curl --netrc -X PATCH https://api.heroku.com/apps/$YOUR_HEROKU_APP/formation \
-d '{
"updates": [
{
"type": "web",
"docker_image": "'"$DOCKER_IMAGE_ID"'"
}
]
}' \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.heroku+json; version=3.docker-releases" \
-H "Authorization: Bearer $DOCKER_PASSWORD"
YOUR_HEROKU_APP=unibuk
DOCKER_IMAGE_ID=$(docker inspect registry.heroku.com/$YOUR_HEROKU_APP/web --format={{.Id}})
curl --netrc -X PATCH https://api.heroku.com/apps/$YOUR_HEROKU_APP/formation \
-d '{
"updates": [
{
"type": "web",
"docker_image": "'"$DOCKER_IMAGE_ID"'"
}
]
}' \
-H "Content-Type: application/json" \
-H "Accept: application/vnd.heroku+json; version=3.docker-releases" \
-H "Authorization: Bearer $DOCKER_PASSWORD"