-
-
Notifications
You must be signed in to change notification settings - Fork 181
/
.gitlab-ci.yml
64 lines (60 loc) · 1.89 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
stages:
- build
- test
- deploy
include:
- template: SAST.gitlab-ci.yml
build:
image: docker
services:
- docker:dind
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
script:
- CI_COMMIT_REF_NAME_SANITIZED=${CI_COMMIT_REF_NAME/\#/-}
- CI_COMMIT_REF_NAME_SANITIZED=${CI_COMMIT_REF_NAME_SANITIZED//\//-}
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME_SANITIZED || true
- docker build --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME_SANITIZED --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME_SANITIZED .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME_SANITIZED
deploy-beta:
stage: deploy
image:
name: alpine/helm:3.12.0
entrypoint: [""]
script:
- helm repo add kobo https://gitlab.com/api/v4/projects/32216873/packages/helm/stable
- helm -n kobo-dev upgrade beta kobo/kobo --atomic --set-string kpi.image.tag=${CI_COMMIT_SHORT_SHA} --reuse-values
environment:
name: beta
url: https://kf.beta.kobotoolbox.org
only:
refs:
- public-beta
variables:
- $CI_COMMIT_REF_PROTECTED
deploy-staging:
stage: deploy
image:
name: alpine/helm
entrypoint: [""]
script:
- BRANCH_TITLE=${CI_COMMIT_BRANCH#feature/}
- helm repo add kobo https://gitlab.com/api/v4/projects/32216873/packages/helm/stable
- helm -n kobo-dev upgrade --install $BRANCH_TITLE kobo/kobo --atomic --set-string kpi.image.tag=${CI_COMMIT_SHORT_SHA} --reuse-values
rules:
- if: $CI_COMMIT_BRANCH =~ /^(feature\/)/ && $CI_COMMIT_REF_PROTECTED
pages:
stage: deploy
image: node:18
script:
- apt-get update && apt-get install python-is-python3
- npm i --force
- npm run build-storybook -- -o public
artifacts:
paths:
- public
only:
refs:
- main
- storybook