-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
54 lines (49 loc) · 1.31 KB
/
.gitlab-ci.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
image: registry.gitlab.com/baldissera/nexteimageserver
stages:
- build
- test
- deploy
# Run test with coverage
unit_test:
stage: test
before_script:
- go get -u github.com/gorilla/mux
- go get -u cloud.google.com/go/storage
- cd app
script:
- go test -cover
# Build application
build_app:
stage: build
before_script:
- go get -u github.com/gorilla/mux
- go get -u cloud.google.com/go/storage
- cd app
script:
- go build app.go router.go storage.go
# Create new docker image
build_image_for_deploy:
stage: build
image: docker:git
services:
- docker:dind
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.gitlab.com
- docker build -t registry.gitlab.com/baldissera/nexteimageserver .
- docker push registry.gitlab.com/baldissera/nexteimageserver:latest
only:
- tags
# Deploy new version to Heroku
deploy:
stage: deploy
image: docker:git
services:
- docker:dind
before_script:
- docker login --username=_ --password=$HEROKU registry.heroku.com
script:
- docker pull registry.gitlab.com/baldissera/nexteimageserver:latest
- docker tag registry.gitlab.com/baldissera/nexteimageserver:latest registry.heroku.com/nexte-server-image/beta
- docker push registry.heroku.com/nexte-server-image/beta
only:
- tags