-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathJenkinsfile
More file actions
63 lines (60 loc) · 1.6 KB
/
Jenkinsfile
File metadata and controls
63 lines (60 loc) · 1.6 KB
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
pipeline {
agent any
stages {
stage('Build Parameters') {
when {
branch "main"
}
steps {
script {
properties([parameters([
booleanParam(defaultValue: false,
description: 'Release',
name: 'RELEASE'),
stringParam(defaultValue: 'auto',
description: 'Version, "auto" for automatic versioning, or specify a version number (e.g. 1.0.0)',
name: 'VERSION'),
])])
}
}
}
// When building on the main branch, we want to deploy the project to the
// repository to expose the artifact to other projects
stage('Deploy Project') {
when {
branch "main"
}
steps {
sh 'bin/mvn clean deploy --no-transfer-progress --update-snapshots'
}
}
// When building on a branch other than main, we intend to build the project
// but not deploy it to the repository. Since it is not mainline yet.
stage('Build Project') {
when {
not { branch "main" }
}
steps {
sh 'bin/mvn clean package --no-transfer-progress --update-snapshots'
}
}
stage('Release') {
when {
branch "main"
expression {
return params.RELEASE == true
}
}
steps {
sh "bin/dev release '$VERSION'"
}
}
}
post {
always {
junit allowEmptyResults: true,
testResults: 'test-results.xml'
archiveArtifacts artifacts: '**/target/*.jar', fingerprint: true
}
}
}