simplify ci
This commit is contained in:
parent
aa542372cc
commit
f498d840f3
21
Jenkinsfile
vendored
21
Jenkinsfile
vendored
@ -8,32 +8,15 @@ pipeline {
|
|||||||
versionPrefix: '1.0.',
|
versionPrefix: '1.0.',
|
||||||
worstResultForIncrement: 'SUCCESS'
|
worstResultForIncrement: 'SUCCESS'
|
||||||
])
|
])
|
||||||
publish = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Setup') {
|
stage('Building') {
|
||||||
steps {
|
steps {
|
||||||
echo 'Setting up test environment'
|
|
||||||
sh 'yarn --frozen-lockfile'
|
|
||||||
sh 'nodejs jenkins.js ${VERSION}'
|
|
||||||
script {
|
script {
|
||||||
currentBuild.displayName = env.VERSION
|
currentBuild.displayName = env.VERSION
|
||||||
}
|
}
|
||||||
}
|
sh 'yarn ci ${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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
jenkins.js
23
jenkins.js
@ -1,16 +1,25 @@
|
|||||||
/*
|
/* eslint-disable no-process-exit */
|
||||||
* Copyright (C) Sapphirecode - All Rights Reserved
|
/* eslint-disable no-console */
|
||||||
* This file is part of snippeteer which is released under BSD-3-Clause.
|
/* eslint-disable no-sync */
|
||||||
* See file 'LICENSE' for full license details.
|
|
||||||
* Created by Timo Hocker <timo@scode.ovh>, January 2020
|
|
||||||
*/
|
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const fs = require ('fs');
|
const fs = require ('fs');
|
||||||
|
const child_process = require ('child_process');
|
||||||
|
|
||||||
const pkg = JSON.parse (fs.readFileSync ('package.json', 'utf-8'));
|
const pkg = JSON.parse (fs.readFileSync ('package.json', 'utf-8'));
|
||||||
[
|
[
|
||||||
,, pkg.version
|
,, pkg.version
|
||||||
] = process.argv;
|
] = process.argv;
|
||||||
fs.writeFileSync ('package.json', JSON.stringify (pkg, null, 2));
|
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');
|
||||||
|
});
|
||||||
|
@ -7,7 +7,8 @@
|
|||||||
"snippeteer": "./index.js"
|
"snippeteer": "./index.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint --fix ."
|
"lint": "eslint --fix .",
|
||||||
|
"ci": "yarn --frozen-lockfile && node jenkins.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user