-
Notifications
You must be signed in to change notification settings - Fork 8
/
Jenkinsfile
56 lines (45 loc) · 1.76 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
#!/usr/bin/env groovy
node('rhel7'){
def javaHome = tool 'openjdk-17'
env.JAVA_HOME = "${javaHome}"
stage('Checkout repo') {
deleteDir()
git url: 'https://github.com/redhat-developer/intellij-rsp',
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-rsp/ <<< \$'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: 'rstryker'
}
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-rsp/ <<< \$'put -p \"${zip[0].path}\"'"
}
}
}
}
}