[no publish] simplify ci
This commit is contained in:
parent
fd26ee2614
commit
59249a3a1c
21
Jenkinsfile
vendored
21
Jenkinsfile
vendored
@ -8,32 +8,15 @@ pipeline {
|
|||||||
versionPrefix: '1.2.',
|
versionPrefix: '1.2.',
|
||||||
worstResultForIncrement: 'SUCCESS'
|
worstResultForIncrement: 'SUCCESS'
|
||||||
])
|
])
|
||||||
publish = 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
stage('Setup') {
|
stage('Building') {
|
||||||
steps {
|
steps {
|
||||||
echo 'Setting up 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"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
jenkins.js
28
jenkins.js
@ -1,5 +1,25 @@
|
|||||||
const fs = require('fs')
|
/* eslint-disable no-process-exit */
|
||||||
|
/* eslint-disable no-console */
|
||||||
|
/* eslint-disable no-sync */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'))
|
const fs = require ('fs');
|
||||||
pkg.version = process.argv[2]
|
const child_process = require ('child_process');
|
||||||
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2))
|
|
||||||
|
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');
|
||||||
|
});
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
"description": "scode eslint standard configuration",
|
"description": "scode eslint standard configuration",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint --fix ."
|
"lint": "eslint --fix .",
|
||||||
|
"ci": "yarn --frozen-lockfile && node jenkins.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -26,7 +27,7 @@
|
|||||||
"eslint-plugin-standard": "^4.0.1"
|
"eslint-plugin-standard": "^4.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"eslint-plugin-import": "^2.20.0",
|
"eslint-plugin-import": "^2.20.1",
|
||||||
"eslint-plugin-jsdoc": "^21.0.0",
|
"eslint-plugin-jsdoc": "^21.0.0",
|
||||||
"eslint-plugin-node": "^11.0.0",
|
"eslint-plugin-node": "^11.0.0",
|
||||||
"eslint-plugin-sort-requires-by-path": "^1.0.2",
|
"eslint-plugin-sort-requires-by-path": "^1.0.2",
|
||||||
|
@ -291,7 +291,7 @@ eslint-plugin-es@^3.0.0:
|
|||||||
eslint-utils "^2.0.0"
|
eslint-utils "^2.0.0"
|
||||||
regexpp "^3.0.0"
|
regexpp "^3.0.0"
|
||||||
|
|
||||||
eslint-plugin-import@^2.20.0:
|
eslint-plugin-import@^2.20.1:
|
||||||
version "2.20.1"
|
version "2.20.1"
|
||||||
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz#802423196dcb11d9ce8435a5fc02a6d3b46939b3"
|
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.20.1.tgz#802423196dcb11d9ce8435a5fc02a6d3b46939b3"
|
||||||
integrity sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw==
|
integrity sha512-qQHgFOTjguR+LnYRoToeZWT62XM55MBVXObHM6SKFd1VzDcX/vqT1kAz8ssqigh5eMj8qXcRoXXGZpPP6RfdCw==
|
||||||
|
Loading…
x
Reference in New Issue
Block a user