-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
36 lines (34 loc) · 1.81 KB
/
Jenkinsfile
File metadata and controls
36 lines (34 loc) · 1.81 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
def isRelease = env.TAG_NAME
String version = "${env.BRANCH_NAME}${(isRelease ? ".${env.BUILD_NUMBER}" : '-SNAPSHOT')}"
node {
try {
stage('Checkout') {
cleanWs()
checkout scm
}
stage('Build') {
echo "My branch is: ${env.BRANCH_NAME}"
withSonarQubeEnv('localhostSonarQube') {
bat "gradlew.bat --info clean build sonarqube -Dinoks.java.monads.version=${version}"
}
currentBuild.description = version
}
stage('Archive') {
archiveArtifacts artifacts: 'build/**/*.jar'
withCredentials([file(credentialsId: 'gpg-signed', variable: 'gradleProperties')]) {
def fileContent = readFile gradleProperties
writeFile file: 'gradle.properties', text: fileContent
withCredentials([usernamePassword(credentialsId: 'nexus', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUsername')]) {
bat "gradlew.bat --info upload -Dinoks.java.monads.version=${version} -PnexusUsername=${nexusUsername} -PnexusPassword=${nexusPassword}"
}
withCredentials([usernamePassword(credentialsId: 'oss.sonartype.org', passwordVariable: 'nexusPassword', usernameVariable: 'nexusUsername')]) {
def nexusUrlRelease = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
def nexusUrlSnapshot = "https://oss.sonatype.org/content/repositories/snapshots"
bat "gradlew.bat --info upload -Dinoks.java.monads.version=${version} -PnexusUsername=${nexusUsername} -PnexusPassword=${nexusPassword} -PnexusUrlRelease=${nexusUrlRelease} -PnexusUrlSnapshot=${nexusUrlSnapshot}"
}
}
}
} catch (Exception t) {
throw t
}
}