-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
72 lines (65 loc) · 1.73 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
## Continuous Integration Jobs definition
stages:
- test
- build
- release
- publish
cache:
key: "video-cli-node12"
paths:
- .npm-cache
variables:
CONTAINER_RELEASE_IMAGE_BASE: $CI_REGISTRY/images/video-processing-cli
test:
image: node:12
stage: test
before_script:
- npm config set cache .npm-cache
- npm install -q
script:
- npm run run install
- npm run test
tags:
- docker
## Build the standalone executables
package:
image: node:12
stage: build
before_script:
- npm config set cache .npm-cache
- npm install -q
script:
- npm run production
- ./dist/video-processing-cli-linux --help
tags:
- docker
artifacts:
paths:
- dist
## Build the docker image with the CLI application
package_docker:
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t $CI_REGISTRY_IMAGE:${CI_BUILD_REF_NAME/v/} .
- docker push $CI_REGISTRY_IMAGE:${CI_BUILD_REF_NAME/v/}
tags:
- deploy
only:
- tags
- master
## Publishes the docker image on the public registry
package_docker_publish:
stage: publish
only:
- tags
tags:
- dind
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE:${CI_BUILD_REF_NAME/v/}
- docker login -u $REGISTRY_RELEASE_USERNAME -p $REGISTRY_RELEASE_PASSWORD $CI_REGISTRY
- docker tag $CI_REGISTRY_IMAGE:${CI_BUILD_REF_NAME/v/} "$CONTAINER_RELEASE_IMAGE_BASE:${CI_BUILD_REF_NAME/v/}"
- docker tag $CI_REGISTRY_IMAGE:${CI_BUILD_REF_NAME/v/} "$CONTAINER_RELEASE_IMAGE_BASE:latest"
- docker push "$CONTAINER_RELEASE_IMAGE_BASE:latest"
- docker push "$CONTAINER_RELEASE_IMAGE_BASE:${CI_BUILD_REF_NAME/v/}"