Skip to content

Commit

Permalink
add jenkins pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
gorkem committed Oct 4, 2017
1 parent 09a3505 commit 02b9e93
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .vscodeignore
@@ -0,0 +1,16 @@
.vscode/**
typings/**
out/test/**
test/**
src/**
images/**
**/*.map
.gitignore
.github/**
tsconfig.json
vsc-extension-quickstart.md
undefined/**
CONTRIBUTING.md
.vscode-test/**
**/**.vsix
**/**.tar.gz
57 changes: 57 additions & 0 deletions Jenkinsfile
@@ -0,0 +1,57 @@
#!/usr/bin/env groovy

def installBuildRequirements(){
def nodeHome = tool 'nodejs-7.7.4'
env.PATH="${env.PATH}:${nodeHome}/bin"
sh "npm install -g typescript"
sh "npm install -g vsce"
}

def buildVscodeExtension(){
sh "npm install"
sh "npm run vscode:prepublish"
}

node('rhel7'){

stage 'Checkout vscode-yaml code'
deleteDir()
git url: 'https://github.com/redhat-developer/vscode-yaml.git'

stage 'install vscode-yaml build requirements'
installBuildRequirements()

stage 'Build vscode-yaml'
sh "npm install"
sh "npm run vscode:prepublish"

stage 'Test vscode-yaml for staging'
wrap([$class: 'Xvnc']) {
sh "npm test --silent"
}

stage "Package vscode-yaml"
def packageJson = readJSON file: 'package.json'
sh "vsce package -o yaml-${packageJson.version}-${env.BUILD_NUMBER}.vsix"

stage 'Upload vscode-yaml to staging'
def vsix = findFiles(glob: '**.vsix')
sh "rsync -Pzrlt --rsh=ssh --protocol=28 ${vsix[0].path} ${UPLOAD_LOCATION}"
stash name:'vsix', includes:files[0].path
}

node('rhel7'){
if(publishToMarketPlace.equals('true')){
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'gercan'
}

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"
}//if publishMarketPlace
}

0 comments on commit 02b9e93

Please sign in to comment.