-
Notifications
You must be signed in to change notification settings - Fork 9
/
Jenkinsfile
62 lines (53 loc) · 1.85 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
#!/usr/bin/env groovy
node('rhel9'){
stage('Checkout repo') {
deleteDir()
git url: 'https://github.com/camel-tooling/vscode-camel-extension-pack.git',
branch: 'main'
}
stage('Install requirements') {
def nodeHome = tool 'nodejs-lts-20'
env.PATH="${env.PATH}:${nodeHome}/bin"
}
stage('Build') {
sh "npm install"
}
stage('Package') {
try {
def packageJson = readJSON file: 'package.json'
sh "vsce package -o apache-camel-extension-pack-${packageJson.version}-${env.BUILD_NUMBER}.vsix"
}
finally {
archiveArtifacts artifacts: '*.vsix'
}
}
if(params.UPLOAD_LOCATION) {
stage('Snapshot') {
def filesToPush = findFiles(glob: '**.vsix')
sh "sftp -C ${UPLOAD_LOCATION}/snapshots/vscode-camel-extension-pack/ <<< \$'put -p -r ${filesToPush[0].path}'"
stash name:'vsix', includes:filesToPush[0].path
}
}
}
node('rhel9'){
if(publishToMarketPlace.equals('true')){
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'apupier,lheinema,tsedmik,djelinek,jraez,mdinizde'
}
stage("Publish to Marketplace") {
unstash 'vsix'
withCredentials([[$class: 'StringBinding', credentialsId: 'vscode_java_marketplace', variable: 'TOKEN']]) {
def vsix = findFiles(glob: '**.vsix')
sh 'vsce publish -p ${TOKEN} --packagePath' + " ${vsix[0].path}"
}
archive includes:"**.vsix"
stage "Promote the build to stable"
def vsix = findFiles(glob: '**.vsix')
sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-camel-extension-pack/ <<< \$'put -p -r ${vsix[0].path}'"
sh "npm install -g ovsx"
withCredentials([[$class: 'StringBinding', credentialsId: 'open-vsx-access-token', variable: 'OVSX_TOKEN']]) {
sh 'ovsx publish -p ${OVSX_TOKEN}' + " ${vsix[0].path}"
}
}
}
}