-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
44 lines (39 loc) · 1.37 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
variables:
MAVEN_SETTINGS_FILE_LOCATION_WITHIN_PROJECT: "/resources/settings.xml"
MAVEN_SETTINGS_TARGET_LOCATION: "/opt/settings.xml"
UPDATED_MAVEN_SETTINGS_LOCATION: "/opt/deploysettings.xml"
# define runner for all jobs
.common:
tags:
- &GITLAB_RUNNER docker
before_script:
- mv ${CI_PROJECT_DIR}/${MAVEN_SETTINGS_FILE_LOCATION_WITHIN_PROJECT} ${MAVEN_SETTINGS_TARGET_LOCATION}
- export MAVEN_REPO_AUTH_USER=${MVN_SERVICE_AUTH_USER}
- export MAVEN_REPO_AUTH_PW=${MVN_SERVICE_AUTH_PW}
- envsubst < ${MAVEN_SETTINGS_TARGET_LOCATION} >> ${UPDATED_MAVEN_SETTINGS_LOCATION}
- cd ${CI_PROJECT_DIR}
stages:
- mavenbuild
# every changes which you make in branches will generate a snapshot build
# snapshots can be overridden
snapshot-package-build:
tags:
- *GITLAB_RUNNER
except:
- master
image: ${MAVEN_BUILD_IMAGE}
stage: mavenbuild
script:
- mvn clean compile test package deploy -s ${UPDATED_MAVEN_SETTINGS_LOCATION} -P snapshot-build-profile -q
# release build will be triggered only if there are master branch changes
# releases are unique, can not be overridden
release-package-build:
tags:
- *GITLAB_RUNNER
only:
- master
image: ${MAVEN_BUILD_IMAGE}
stage: mavenbuild
script:
- mvn versions:set -DremoveSnapshot
- mvn clean compile test package deploy -s ${UPDATED_MAVEN_SETTINGS_LOCATION} -P release-build-profile -q