-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
112 lines (112 loc) · 2.27 KB
/
Jenkinsfile
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
100
101
102
103
104
105
106
107
108
109
110
111
112
pipeline {
agent {
label 'maven'
}
environment {
CODECOV_TOKEN = credentials('geojson-codecov-token')
TEST = true
DEPLOY = true
SNAPSHOT_SITE = true
RELEASE_SITE = true
DEPLOY_FEATURE = false
}
tools {
jdk 'jdk17'
maven 'm3'
}
options {
buildDiscarder(logRotator(numToKeepStr: '8', artifactNumToKeepStr: '8'))
}
stages {
stage('Tools') {
steps {
sh 'java -version'
sh 'mvn -B --version'
}
}
stage('Test') {
when {
environment name: 'TEST', value: 'true'
}
steps {
sh 'mvn -B clean test'
}
post {
always {
junit '**/surefire-reports/*.xml'
jacoco(
execPattern: '**/coverage-reports/*.exec'
)
}
}
}
stage('Deploy') {
when {
allOf {
environment name: 'DEPLOY', value: 'true'
anyOf {
branch 'develop'
branch 'main'
}
}
}
steps {
sh 'mvn -B -P deploy deploy'
}
}
stage('Snapshot Site') {
when {
allOf {
environment name: 'SNAPSHOT_SITE', value: 'true'
anyOf {
branch 'develop'
branch 'feature/*'
}
}
}
steps {
sh 'mvn -B clean site-deploy'
}
post {
always {
sh 'curl -s https://codecov.io/bash | bash -s - -t ${CODECOV_TOKEN}'
}
}
}
stage('Release Site') {
when {
allOf {
branch 'main'
environment name: 'RELEASE_SITE', value: 'true'
}
}
steps {
sh 'mvn -B -P gh-pages-site site site:stage scm-publish:publish-scm'
}
post {
always {
sh 'curl -s https://codecov.io/bash | bash -s - -t ${CODECOV_TOKEN}'
}
}
}
stage('Deploy Feature') {
when {
allOf {
branch 'feature/*'
environment name: 'DEPLOY_FEATURE', value: 'true'
}
}
steps {
sh 'mvn -B -P feature,allow-features clean deploy'
}
post {
always {
junit '**/surefire-reports/*.xml'
jacoco(
execPattern: '**/coverage-reports/*.exec'
)
}
}
}
}
}