-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
100 lines (90 loc) · 1.96 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
image: maven:3-jdk-8-slim
stages:
- build
- test
- package
- deploy
variables:
MAVEN_CLI_OPTS: "-Dbamboo.gituser=${GITREPOUSER} -Dbamboo.gittoken=${GITREPOTOKEN} -Ddeploymenttoken=${AWS_ACCESS_KEY_ID} -Ddeploymentsecret=${AWS_SECRET_KEY} -DAWS_DEFAULT_REGION=${AWS_DEFAULT_REGION} -s src/main/resources/env.properties --batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
GSG_RELEASE_BRANCHES: production
.default_cache: &default_cache
key: ${CI_COMMIT_REF_SLUG}
paths:
- .m2/repository/
- target
version:
stage: .pre
image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.21.1
before_script:
- apt update
- apt install --no-install-recommends -y git
- git fetch --tags
script:
- release --bump-patch next-version > .next-version
- cat .next-version
artifacts:
paths:
- .next-version
except:
- tags
build:
stage: build
cache:
<< : *default_cache
policy: pull-push
script:
- mvn clean
- export RELEASE_VERSION=$(<.next-version)
- mvn versions:set -DnewVersion=$RELEASE_VERSION -DprocessAllModules
- mvn $MAVEN_CLI_OPTS compile
artifacts:
paths:
- pom.xml
except:
- tags
test:
stage: test
cache:
<< : *default_cache
policy: pull-push
script:
- mvn $MAVEN_CLI_OPTS test
except:
- tags
package:
stage: package
cache:
<< : *default_cache
policy: pull-push
script:
- mvn $MAVEN_CLI_OPTS package
artifacts:
paths:
- target/madana-*-*.jar
except:
- tags
version_tag:
stage: deploy
image: registry.gitlab.com/juhani/go-semrel-gitlab:v0.21.1
before_script:
- apt update
- apt install --no-install-recommends -y git
- git fetch --tags
script:
- release --bump-patch commit-and-tag pom.xml
except:
- tags
deploy:
stage: deploy
cache:
<< : *default_cache
policy: pull
environment:
name: github-registry
script:
- mvn $MAVEN_CLI_OPTS deploy
except:
- tags
only:
- production