-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
51 lines (42 loc) · 1.28 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
# based on the template from
# https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/lib/gitlab/ci/templates/Maven.gitlab-ci.yml
variables:
MAVEN_CLI_OPTS: "--batch-mode --fail-at-end --show-version -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -DinstallAtEnd=true -DdeployAtEnd=true"
image: maven:3.6-jdk-11
cache:
paths:
- .m2/repository
# For merge requests do not `deploy` but only run `verify`.
.verify: &verify
stage: test
script:
- 'mvn $MAVEN_CLI_OPTS verify'
except:
- main
# Verify merge requests
verify:jdk11:
<<: *verify
pages:
stage: deploy
script:
- mkdir -p public
- mvn clean
- mkdir -p target
- mvn test -l target/mvn.log || mvn compile
- cp target/index.html public/
artifacts:
paths:
- public
only:
variables:
- $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
deploy:jdk11:
stage: deploy
script:
- if [ ! -f resources/ci_settings.xml ];
then echo "CI settings missing\! If deploying to GitLab Maven Repository, please see https://docs.gitlab.com/ee/user/packages/maven_repository/index.html#create-maven-packages-with-gitlab-cicd for instructions.";
fi
- 'mvn $MAVEN_CLI_OPTS deploy -s resources/ci_settings.xml'
only:
variables:
- $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH