-
Notifications
You must be signed in to change notification settings - Fork 7
/
.gitlab-ci.yml
83 lines (74 loc) · 1.28 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
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
stages:
- build
- test
- lint
- push
- new_release
- deploy
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build:
stage: build
only:
- main
- dev
- merge_requests
script:
- docker build --tag="$CI_REGISTRY_IMAGE":"$CI_COMMIT_REF_NAME" .
test:
stage: test
only:
- main
- dev
- merge_requests
script:
- docker-compose run simple_app python manage.py test
lint:
stage: lint
only:
- merge_requests
script:
- docker-compose run simple_app pylint simple_app
push:
stage: push
only:
- main
- dev
script:
- docker push "$CI_REGISTRY_IMAGE":"$CI_COMMIT_REF_NAME"
new_release:
stage: new_release
script:
- echo "Create new release."
rules:
- if: "$CI_COMMIT_TAG"
when: always
release:
tag_name: "$CI_COMMIT_TAG"
description: "Release for $CI_COMMIT_TAG"
deploy dev:
stage: deploy
environment:
name: dev
tags:
- dev
only:
- main
- dev
script:
- docker-compose pull
- docker-compose down
- docker-compose up -d
deploy prod:
stage: deploy
when: manual
environment:
name: prod
tags:
- prod
only:
- main
script:
- docker-compose pull
- docker-compose down
- docker-compose up -d