-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
70 lines (65 loc) · 1.63 KB
/
.gitlab-ci.yml
File metadata and controls
70 lines (65 loc) · 1.63 KB
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
stages:
- build
- publish
- mirror
variables:
production_repo: ubleipzig/dev-www
dev-www_build:
stage: build
image: ubleipzig/deployer:1.5.0
services:
- docker:dind
script: |
deployer build \
--build-arg HTTP_PROXY="${HTTP_PROXY}" \
--build-arg FTP_PROXY="${FTP_PROXY}" \
--build-arg HTTPS_PROXY="${HTTPS_PROXY}" \
--build-arg NO_PROXY="${NO_PROXY}" \
--output image.tar.gz
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- image.tar.gz
artifacts:
name: docker-image
paths:
- image.tar.gz
tags:
- docker
dev-www_publish:
stage: publish
image: ubleipzig/deployer:1.5.0
services:
- docker:dind
script: |
export version=`expr ${CI_COMMIT_TAG} ':' 'release/\(.\+\)'`
export major_version=`expr ${version} ':' '\([^.]\+\)'`
export minor_version=`expr ${version} ':' '[^.]\+\.\([^.-]\+\)'`
export patch_version=`expr ${version} ':' '[^.]\+\.[^.]\+[-.]\(.\+\)'`
deployer publish \
--input image.tar.gz \
--docker-config "${DOCKER_PRODUCTION_AUTH_CONFIG}" \
--name ${production_repo} \
--tag latest \
--tag ${version} \
--tag "${major_version}.${minor_version}" \
--tag "${major_version}"
dependencies:
- dev-www_build
tags:
- docker
only:
- /^release\/.*/
github_mirror:
stage: mirror
image:
name: alpine/git:latest
entrypoint: [ "/bin/sh", "-c" ]
script: |
cd /tmp
git clone --mirror ${CI_REPOSITORY_URL} project
cd project
git remote add github https://$GITHUB_USER:$GITHUB_TOKEN@github.com/ubleipzig/dev-www.git
git push --mirror github
tags:
- docker