simplify ci

This commit is contained in:
Timo Hocker 2020-02-06 17:36:09 +01:00
parent aa542372cc
commit f498d840f3
3 changed files with 21 additions and 28 deletions

21
Jenkinsfile vendored
View File

@ -8,32 +8,15 @@ pipeline {
versionPrefix: '1.0.',
worstResultForIncrement: 'SUCCESS'
])
publish = 0
}
stages {
stage('Setup') {
stage('Building') {
steps {
echo 'Setting up test environment'
sh 'yarn --frozen-lockfile'
sh 'nodejs jenkins.js ${VERSION}'
script {
currentBuild.displayName = env.VERSION
}
}
}
}
post {
success {
script {
publish = sh script: "git log -1 | grep '\\[no publish\\]'", returnStatus: true
if (publish != 0) {
echo 'Deploying'
sh 'yarn publish'
} else {
echo 'Build successful, Commit not marked for deploying'
currentBuild.result = "UNSTABLE"
}
sh 'yarn ci ${VERSION}'
}
}
}

View File

@ -1,16 +1,25 @@
/*
* Copyright (C) Sapphirecode - All Rights Reserved
* This file is part of snippeteer which is released under BSD-3-Clause.
* See file 'LICENSE' for full license details.
* Created by Timo Hocker <timo@scode.ovh>, January 2020
*/
/* eslint-disable no-process-exit */
/* eslint-disable no-console */
/* eslint-disable no-sync */
'use strict';
const fs = require ('fs');
const child_process = require ('child_process');
const pkg = JSON.parse (fs.readFileSync ('package.json', 'utf-8'));
[
,, pkg.version
] = process.argv;
fs.writeFileSync ('package.json', JSON.stringify (pkg, null, 2));
child_process.execSync ('yarn lint', { stdio: 'inherit' });
child_process.exec ('git log -1 | grep \'\\[no publish\\]\'')
.addListener ('exit', (code) => {
if (code === 0) {
console.log ('build not marked for deployment');
process.exit (1);
}
else
child_process.execSync ('yarn publish');
});

View File

@ -7,7 +7,8 @@
"snippeteer": "./index.js"
},
"scripts": {
"lint": "eslint --fix ."
"lint": "eslint --fix .",
"ci": "yarn --frozen-lockfile && node jenkins.js"
},
"repository": {
"type": "git",