-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
56 lines (51 loc) · 1.08 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
services:
- docker:dind
variables:
IMAGE_NAME: registry.gitlab.com/tokend/hgate:$CI_COMMIT_SHA
DH_IMAGE_NAME: tokend/hgate
stages:
- build
- pages
- publish
# build & publish docker image to the registry
build:
image: docker:latest
stage: build
tags:
- tokend
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build --pull -t $IMAGE_NAME .
- docker push $IMAGE_NAME
pages:
image: node:8
stage: pages
tags:
- tokend
only:
refs:
- master
changes:
- docs/**/*
script:
- cd docs
- npm install
- mkdir -p ../public
- npm run release-build
artifacts:
paths:
- public
publish:
image: docker:latest
stage: publish
tags:
- tokend
only:
- /^\d+\.\d+\.\d+.*$/
script:
- RELEASE=$CI_COMMIT_REF_NAME
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PWD
- docker pull $IMAGE_NAME
- docker tag $IMAGE_NAME $DH_IMAGE_NAME:$RELEASE
- docker push $DH_IMAGE_NAME:$RELEASE