forked from redhat-developer/intellij-tekton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
52 lines (43 loc) · 1.73 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
#!/usr/bin/env groovy
node('rhel7'){
stage('Checkout repo') {
deleteDir()
git url: 'https://github.com/redhat-developer/intellij-tekton',
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 "rsync -Pzrlt --rsh=ssh --protocol=28 ${filesToPush[0].path} ${UPLOAD_LOCATION}/snapshots/intellij-tekton/"
stash name:'zip', includes:filesToPush[0].path
}
}
if(publishToMarketPlace.equals('true')){
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'jmaury'
}
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 "rsync -Pzrlt --rsh=ssh --protocol=28 ${zip[0].path} ${UPLOAD_LOCATION}/stable/intellij-tekton/"
}
}
}
}
}