forked from softdevteam/mattermost-github-integration
-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
50 lines (46 loc) · 1.19 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
stages:
- build
- deploy
- sync
build:
stage: build
script:
- docker build -t ${CI_PROJECT_NAME}:${CI_BUILD_REF_NAME} .
tags:
- docker-build
deploy:
stage: deploy
script:
- docker login --username=${DOCKER_CLOUD_USERNAME} --password=${DOCKER_CLOUD_PASSWORD}
- docker tag ${CI_PROJECT_NAME}:${CI_BUILD_REF_NAME} ${DOCKER_CLOUD_REPO}:${CI_BUILD_REF_NAME}
- docker push ${DOCKER_CLOUD_REPO}:${CI_BUILD_REF_NAME}
only:
- master
- dev
- tags
when: on_success
tags:
- docker-build
tag_latest:
stage: deploy
script:
- docker login --username=${DOCKER_CLOUD_USERNAME} --password=${DOCKER_CLOUD_PASSWORD}
- docker tag ${CI_PROJECT_NAME}:${CI_BUILD_REF_NAME} ${DOCKER_CLOUD_REPO}:latest
- docker push ${DOCKER_CLOUD_REPO}:latest
only:
- master
when: on_success
tags:
- docker-build
sync:
stage: sync
image: zaporylie/git
script:
- ssh-keyscan -H ${GIT_SYNC_REMOTE_HOST} >> ~/.ssh/known_hosts
- git remote rm sync || true
- git remote add sync ${GIT_SYNC_REMOTE_URL}
- git checkout ${CI_BUILD_REF_NAME}
- git pull origin ${CI_BUILD_REF_NAME}
- git push sync ${CI_BUILD_REF_NAME} --tags
tags:
- docker-build