.gitlab-ci.yml 1.46 KB
Newer Older
Sandro Lutz's avatar
Sandro Lutz committed
1
stages:
Hermann's avatar
Hermann committed
2
  - test
Sandro Lutz's avatar
Sandro Lutz committed
3
  - build
Sandro Lutz's avatar
Sandro Lutz committed
4
5
  - deploy

Hermann's avatar
Hermann committed
6
7
8
9
10
11
12
13
eslint:
  stage: test
  image: node:latest
  before_script:
   - npm install
  script:
   - npm run lint

Sandro Lutz's avatar
Sandro Lutz committed
14
15
16
17
18
19
20
21
build_master_dev:
  stage: build
  image: docker:latest
  services:
    - docker:dind
  before_script:
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
  script:
22
    - docker build --build-arg NPM_BUILD_COMMAND=build-dev --pull -t "$CI_REGISTRY_IMAGE:dev" ./
Sandro Lutz's avatar
Sandro Lutz committed
23
24
25
26
    - docker push "$CI_REGISTRY_IMAGE:dev"
  only:
    - master

Sandro Lutz's avatar
Sandro Lutz committed
27
build_master_prod:
Sandro Lutz's avatar
Sandro Lutz committed
28
29
30
31
  stage: build
  image: docker:latest
  services:
    - docker:dind
Sandro Lutz's avatar
Sandro Lutz committed
32
  before_script:
Sandro Lutz's avatar
Sandro Lutz committed
33
    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
Sandro Lutz's avatar
Sandro Lutz committed
34
  script:
Sandro Lutz's avatar
Sandro Lutz committed
35
36
37
38
39
    - docker build --pull -t "$CI_REGISTRY_IMAGE" ./
    - docker push "$CI_REGISTRY_IMAGE"
  only:
    - master

Sandro Lutz's avatar
Sandro Lutz committed
40
41
42
43
44
45
46
47
48
49
50
# On branches except master: verify that build works, do not push to registry
build:
  stage: build
  image: docker:latest
  services:
    - docker:dind
  script:
    - docker build --pull ./
  except:
    - master

Sandro Lutz's avatar
Sandro Lutz committed
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
deploy_prod:
  stage: deploy
  image: amiveth/service-update-helper
  script:
    - /update.py
  only:
    - master

deploy_dev:
  stage: deploy
  image: amiveth/service-update-helper
  script:
    - export CI_DEPLOY_SERVICE="$CI_DEPLOY_SERVICE_DEV"
    - /update.py
  only:
    - master

deploy_prod:
Sandro Lutz's avatar
Sandro Lutz committed
69
  stage: deploy
Sandro Lutz's avatar
Sandro Lutz committed
70
  image: amiveth/service-update-helper
Sandro Lutz's avatar
Sandro Lutz committed
71
  script:
Sandro Lutz's avatar
Sandro Lutz committed
72
    - export CI_DEPLOY_SERVICE="$CI_DEPLOY_SERVICE_PROD"
Sandro Lutz's avatar
Sandro Lutz committed
73
    - /update.py
Sandro Lutz's avatar
Sandro Lutz committed
74
75
  only:
    - master