.gitlab-ci.yml 1.22 KB
Newer Older
Ludovic Cottret's avatar
Ludovic Cottret committed
1
2
image: maven:latest

Ludovic Cottret's avatar
Ludovic Cottret committed
3
4
5
6
variables:
   MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
   MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"

Ludovic Cottret's avatar
Ludovic Cottret committed
7
8
9
10
11
12
cache:
  paths:
    - .m2/repository/
    - target/

build:
Ludovic Cottret's avatar
Ludovic Cottret committed
13
14
15
16
17
18
19
20
21
  stage: build
  script:
    - mvn compile

test:
  stage: test
  script:
    - mvn test

Ludovic Cottret's avatar
Ludovic Cottret committed
22
verify:
Ludovic Cottret's avatar
Ludovic Cottret committed
23
  stage: test
Ludovic Cottret's avatar
Ludovic Cottret committed
24
25
26
  script:
    - mvn verify

Ludovic Cottret's avatar
Ludovic Cottret committed
27
28
29
30
31
32
33
deploySnapshot:
  stage: deploy
  script:
    - mvn $MAVEN_CLI_OPTS deploy -Dmaven.test.skip=true 
  only: 
   - develop

lcottret's avatar
lcottret committed
34
35
deployCentral:
  stage: deploy
lcottret's avatar
lcottret committed
36
  before_script:
lcottret's avatar
lcottret committed
37
38
39
40
    - yum update -y
    - yum install -y which && \
    - yum clean all
    - which ssh-agent || ( yum update -y && yum install -y  openssh-client )
lcottret's avatar
lcottret committed
41
42
43
44
45
46
    - eval `ssh-agent -s`
    - echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null # add ssh ke
    - mkdir -p ~/.ssh
    - chmod 700 ~/.ssh
    - echo "$SSH_PUBLIC_KEY" >> ~/.ssh/id_rsa.pub
    - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
lcottret's avatar
lcottret committed
47
  script:
lcottret's avatar
lcottret committed
48
49
    - git config --global user.email "$env:GITLAB_USER_EMAIL"
    - git config --global user.name "$env:GITLAB_USER_NAME"
lcottret's avatar
lcottret committed
50
51
    - mvn $MAVEN_CLI_OPTS --batch-mode release:prepare -DautoVersionSubmodules=true -Dmaven.test.skip=true
    - mvn release:perform
lcottret's avatar
lcottret committed
52
53
54
  only:
    - /^release.*$/