-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathJenkinsfile
More file actions
78 lines (67 loc) · 2.87 KB
/
Jenkinsfile
File metadata and controls
78 lines (67 loc) · 2.87 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
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env groovy
node('rhel8'){
stage('Checkout repo') {
deleteDir()
git url: 'https://github.com/redhat-developer/vscode-project-initializer.git'
}
stage('Install requirements') {
def nodeHome = tool 'nodejs-latest'
env.PATH="${env.PATH}:${nodeHome}/bin"
sh "npm install -g typescript vsce"
}
stage('Build') {
sh "npm install"
sh "npm run vscode:prepublish"
}
withEnv(['JUNIT_REPORT_PATH=report.xml']) {
stage('Test') {
wrap([$class: 'Xvnc']) {
sh "npm test --silent"
junit 'report.xml'
}
}
}
stage('Package') {
def packageJson = readJSON file: 'package.json'
sh "vsce package -o project-initializer-${packageJson.version}-${env.BUILD_NUMBER}.vsix"
sh "npm pack && mv project-initializer-${packageJson.version}.tgz project-initializer-${packageJson.version}-${env.BUILD_NUMBER}.tgz"
}
if(params.UPLOAD_LOCATION) {
stage('Snapshot') {
def filesToPush = findFiles(glob: '**.vsix')
sh "sftp -C ${UPLOAD_LOCATION}/snapshots/vscode-project-initializer/ <<< \$'put -p \"${filesToPush[0].path}\"'"
stash name:'vsix', includes:filesToPush[0].path
filesToPush = findFiles(glob: '**.tgz')
stash name:'tgz', includes:filesToPush[0].path
}
}
if(publishToMarketPlace.equals('true') || publishToOVSX.equals('true')) {
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'jmaury'
}
if(publishToMarketPlace.equals('true')) {
stage("Publish to Marketplace") {
unstash 'vsix'
unstash 'tgz'
withCredentials([[$class: 'StringBinding', credentialsId: 'vscode_java_marketplace', variable: 'TOKEN']]) {
def vsix = findFiles(glob: '**.vsix')
sh 'vsce publish -p ${TOKEN} --packagePath' + " ${vsix[0].path}"
}
archiveArtifacts artifacts:"**.vsix,**.tgz"
stage "Promote the build to stable"
def vsix = findFiles(glob: '**.vsix')
sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-project-initializer/ <<< \$'put -p \"${vsix[0].path}\"'"
def tgz = findFiles(glob: '**.tgz')
sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-project-initializer/ <<< \$'put -p \"${tgz[0].path}\"'"
}
}
if (publishToOVSX.equals('true')) {
// Open-vsx Marketplace
sh "npm install -g ovsx"
withCredentials([[$class: 'StringBinding', credentialsId: 'open-vsx-access-token', variable: 'OVSX_TOKEN']]) {
def vsix = findFiles(glob: '**.vsix')
sh 'ovsx publish -p ${OVSX_TOKEN}' + " ${vsix[0].path}"
}
}
}
}