.gitlab-ci.yml 1.14 KB
Newer Older
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
1
2
3
stages:
  - lint
  - build
Lukas Burgey's avatar
Lukas Burgey committed
4
  - deploy
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
5
6

lint:
Lukas Burgey's avatar
Lukas Burgey committed
7
  image: golang:1.12-alpine
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
8
9
  stage: lint
  script:
Lukas Burgey's avatar
Lukas Burgey committed
10
11
    - apk add --no-cache git make
    - make lint
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
12
13

build:
Lukas Burgey's avatar
Lukas Burgey committed
14
  image: golang:1.12-alpine
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
15
16
  stage: build
  script:
Lukas Burgey's avatar
Lukas Burgey committed
17
    - apk add --no-cache git make
Lukas Burgey's avatar
Lukas Burgey committed
18
    - make build-static
Lukas Burgey's avatar
Add CI    
Lukas Burgey committed
19
20
21
  artifacts:
    paths:
      - feudalClient
Lukas Burgey's avatar
Lukas Burgey committed
22

Lukas Burgey's avatar
Lukas Burgey committed
23
deploy-dev:
Lukas Burgey's avatar
Lukas Burgey committed
24
  image: netroby/alpine-rsync
Lukas Burgey's avatar
Lukas Burgey committed
25
26
27
  stage: deploy
  only:
    - dev
Lukas Burgey's avatar
Lukas Burgey committed
28
29
30
31
  environment:
    name: dev
  dependencies:
    - build
Lukas Burgey's avatar
Lukas Burgey committed
32
33
34
35
36
37
38
  script:
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
    - rsync -v feudalClient $DEV_USER@$DEV_HOST:bin/feudalClientDev
Lukas Burgey's avatar
Lukas Burgey committed
39
    - ssh $DEV_USER@$DEV_HOST -- systemctl --user restart devClient@0 devClient@1 devClient@2
Lukas Burgey's avatar
Lukas Burgey committed
40

Lukas Burgey's avatar
Lukas Burgey committed
41
deploy-master:
Lukas Burgey's avatar
Lukas Burgey committed
42
  image: netroby/alpine-rsync
Lukas Burgey's avatar
Lukas Burgey committed
43
44
45
  stage: deploy
  only:
    - master
Lukas Burgey's avatar
Lukas Burgey committed
46
47
48
49
  environment:
    name: master
  dependencies:
    - build
Lukas Burgey's avatar
Lukas Burgey committed
50
51
52
53
54
55
56
  script:
    - eval $(ssh-agent -s)
    - echo "$SSH_PRIVATE_KEY" | ssh-add -
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
    - rsync -v feudalClient $DEV_USER@$DEV_HOST:bin/feudalClient