-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
executable file
·61 lines (56 loc) · 1.55 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
stages:
- sync-code
- build
- deploy
sync-code:
stage: sync-code
only:
- master
script:
- export GIT_NAME_DIR=`grep -E "url = .*.git" $PWD/.git/config|awk -F 'qiushaocloud/' '{print $2}' | sed s/\.git//g`
- git config --global user.email "[email protected]"
- git config --global user.name "qiushaocloud"
- export GIT_SSH_COMMAND="ssh -o StrictHostKeyChecking=no"
- mkdir -p /root/codes && cd /root/codes
#- chmod 600 /root/.ssh/id_rsa
- git clone ssh://[email protected]:61023/qiushaocloud/$GIT_NAME_DIR.git
- cd $GIT_NAME_DIR && echo `pwd`
- sh push-remote-git-repos.sh
tags:
- qiushaocloud-runner
build:
stage: build
only:
- master
script:
- docker build -t qiushaocloud/site-counter:latest .
tags:
- qiushaocloud-runner
deploy:
stage: deploy
only:
- master
script:
- docker login --username $DOCKER_HUB_USER_NAME --password $DOCKER_HUB_USER_PASSWORD
- docker push qiushaocloud/site-counter:latest
tags:
- qiushaocloud-runner
build-tags:
stage: build
only:
- tags
script:
- docker build -t qiushaocloud/site-counter:latest .
- docker tag qiushaocloud/site-counter:latest qiushaocloud/site-counter:$CI_COMMIT_REF_NAME
tags:
- qiushaocloud-runner
deploy-tags:
stage: deploy
only:
- tags
script:
- docker login --username $DOCKER_HUB_USER_NAME --password $DOCKER_HUB_USER_PASSWORD
- docker push qiushaocloud/site-counter:latest
- docker push qiushaocloud/site-counter:$CI_COMMIT_REF_NAME
tags:
- qiushaocloud-runner