Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 35 additions & 23 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,6 @@
node('rhel8'){
stage('Checkout repos') {
deleteDir()
def hasLsp4mpDir = fileExists 'lsp4mp'
if (!hasLsp4mpDir){
sh 'mkdir lsp4mp'
}
dir ('lsp4mp') {
git url: 'https://github.com/eclipse/lsp4mp.git'
}
def hasServerDir = fileExists 'quarkus-ls'
if (!hasServerDir){
sh 'mkdir quarkus-ls'
Expand All @@ -22,7 +15,7 @@ node('rhel8'){
sh 'mkdir vscode-quarkus'
}
dir ('vscode-quarkus') {
git url: 'https://github.com/redhat-developer/vscode-quarkus.git'
git url: "https://github.com/${params.FORK}/vscode-quarkus.git"
}
}

Expand Down Expand Up @@ -54,10 +47,20 @@ node('rhel8'){
}
}

env.publishPreReleaseFlag = ""
if('true'.equals(publishPreRelease)){
stage("Prepare for pre-release") {
dir ('vscode-quarkus') {
sh "npx gulp prepare_pre_release"
env.publishPreReleaseFlag = "--pre-release"
}
}
}

stage('Package') {
dir ('vscode-quarkus') {
def packageJson = readJSON file: 'package.json'
sh "vsce package -o ../vscode-quarkus-${packageJson.version}-${env.BUILD_NUMBER}.vsix"
sh "vsce package ${env.publishPreReleaseFlag} -o ../vscode-quarkus-${packageJson.version}-${env.BUILD_NUMBER}.vsix"
sh "npm pack && mv vscode-quarkus-${packageJson.version}.tgz ../vscode-quarkus-${packageJson.version}-${env.BUILD_NUMBER}.tgz"
}
}
Expand All @@ -73,32 +76,41 @@ node('rhel8'){
}
}

if('true'.equals(publishToMarketPlace)){
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'fbricon,rgrunber,azerr,davthomp'
if('true'.equals(publishToMarketPlace) || 'true'.equals(publishToOVSX) || 'true'.equals(publishPreRelease)){
if('true'.equals(publishToMarketPlace) || 'true'.equals(publishToOVSX)){
timeout(time:5, unit:'DAYS') {
input message:'Approve deployment?', submitter: 'fbricon,rgrunber,azerr,davthomp'
}
}

stage("Publish to Marketplaces") {
unstash 'vsix'
unstash 'tgz'
def vsix = findFiles(glob: '**.vsix')
// VS Code Marketplace
withCredentials([[$class: 'StringBinding', credentialsId: 'vscode_java_marketplace', variable: 'TOKEN']]) {
sh 'vsce publish -p ${TOKEN} --packagePath' + " ${vsix[0].path}"

if ('true'.equals(publishToMarketPlace) || 'true'.equals(publishPreRelease)) {
// VS Code Marketplace
withCredentials([[$class: 'StringBinding', credentialsId: 'vscode_java_marketplace', variable: 'TOKEN']]) {
sh 'vsce publish -p ${TOKEN} --packagePath' + " ${vsix[0].path}"
}
}

// open-vsx Marketplace
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}"
if ('true'.equals(publishToOVSX)) {
// open-vsx Marketplace
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}"
}
}

archiveArtifacts artifacts:"**.vsix,**.tgz"

stage "Promote the build to stable"
sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-quarkus/ <<< \$'put -p ${vsix[0].path}'"
def tgz = findFiles(glob: '**.tgz')
sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-quarkus/ <<< \$'put -p ${tgz[0].path}'"
if ('true'.equals(publishToMarketPlace)) {
stage "Promote the build to stable"
sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-quarkus/ <<< \$'put -p ${vsix[0].path}'"
def tgz = findFiles(glob: '**.tgz')
sh "sftp -C ${UPLOAD_LOCATION}/stable/vscode-quarkus/ <<< \$'put -p ${tgz[0].path}'"
}
}
}
}
25 changes: 25 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
const gulp = require('gulp');
const rename = require('gulp-rename');
const cp = require('child_process');
const fse = require('fs-extra');

const quarkusServerExtDir = '../quarkus-ls/quarkus.ls.ext/com.redhat.quarkus.ls'
const quarkusServerExt = 'com.redhat.quarkus.ls';
Expand Down Expand Up @@ -62,6 +63,23 @@ gulp.task('buildQuteExtension', (done) => {
done();
});

gulp.task('prepare_pre_release', function (done) {
const json = JSON.parse(fse.readFileSync("./package.json").toString());
const stableVersion = json.version.match(/(\d+)\.(\d+)\.(\d+)/);
const major = stableVersion[1];
const minor = stableVersion[2];
const date = new Date();
const month = date.getMonth() + 1;
const day = date.getDate();
const hours = date.getHours();
const patch = `${date.getFullYear()}${prependZero(month)}${prependZero(day)}${prependZero(hours)}`;
const insiderPackageJson = Object.assign(json, {
version: `${major}.${minor}.${patch}`,
});
fse.writeFileSync("./package.json", JSON.stringify(insiderPackageJson, null, 2));
done();
});

gulp.task('build', gulp.series('buildServer', 'buildExtension','buildQuteServer', 'buildQuteExtension'));

function mvnw() {
Expand All @@ -71,3 +89,10 @@ function mvnw() {
function isWin() {
return /^win/.test(process.platform);
}

function prependZero(number) {
if (number > 99) {
throw "Unexpected value to prepend with zero";
}
return `${number < 10 ? "0" : ""}${number}`;
}