forked from redhat-developer/intellij-quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
64 lines (54 loc) · 2.01 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
#!/usr/bin/env groovy
node('rhel7'){
def recipientList = 'jbosstools-builds@lists.jboss.org'
def javaHome = tool 'openjdk-11'
env.JAVA_HOME = "${javaHome}"
try {
stage('Checkout repo') {
deleteDir()
git url: 'https://github.com/redhat-developer/intellij-quarkus',
branch: "${sha1}"
}
def props = readProperties file: 'gradle.properties'
def isSnapshot = props['projectVersion'].contains('-SNAPSHOT')
def version = isSnapshot?props['projectVersion'].replace('-SNAPSHOT', ".${env.BUILD_NUMBER}"):props['projectVersion'] + ".${env.BUILD_NUMBER}"
stage('Build') {
sh "./gradlew assemble -PprojectVersion=${version}"
}
stage('Package') {
sh "./gradlew buildPlugin -PprojectVersion=${version}"
}
if(params.UPLOAD_LOCATION) {
stage('Upload') {
def filesToPush = findFiles(glob: '**/*.zip')
sh "sftp -C ${UPLOAD_LOCATION}/snapshots/intellij-quarkus/ <<< \$'put -p \"${filesToPush[0].path}\"'"
stash name:'zip', includes:filesToPush[0].path
}
}
if(publishToMarketPlace.equals('true')){
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'jmaury,adietish,sbouchet,azerr,fbricon'
}
def channel = isSnapshot?"nightly":"stable"
stage("Publish to Marketplace") {
unstash 'zip'
withCredentials([[$class: 'StringBinding', credentialsId: 'JetBrains marketplace token', variable: 'TOKEN']]) {
sh "./gradlew publishPlugin -PjetBrainsToken=${TOKEN} -PprojectVersion=${version} -PjetBrainsChannel=${channel}"
}
archive includes:"**.zip"
if (!isSnapshot) {
stage("Promote the build to stable") {
def zip = findFiles(glob: '**/*.zip')
sh "sftp -C ${UPLOAD_LOCATION}/stable/intellij-quarkus/ <<< \$'put -p \"${zip[0].path}\"'"
currentBuild.keepLog = true
currentBuild.description = "${version}"
}
}
}
}
} catch (any) {
currentBuild.result = 'FAILURE'
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${recipientList}", sendToIndividuals: true])
throw any
}
}