feat: enable release channels
This commit is contained in:
Родитель
35dc1190bf
Коммит
d248eed29b
|
@ -28,4 +28,4 @@ after_success:
|
|||
- npm run semantic-release
|
||||
branches:
|
||||
except:
|
||||
- "/^v\\d+\\.\\d+\\.\\d+$/"
|
||||
- "/^v\\d+\\.\\d+\\.\\d+(\\-.*)?$/"
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
const analyzeCommits = require('@semantic-release/commit-analyzer')
|
||||
|
||||
module.exports = function (pluginConfig, config, cb) {
|
||||
// run standard commit analysis
|
||||
return analyzeCommits(pluginConfig, config, function(error, type) {
|
||||
const branch = config.env.TRAVIS_BRANCH;
|
||||
const distTag = config.options.branchTags[branch];
|
||||
let releaseType = type;
|
||||
|
||||
// if branch publishes a dist-tag
|
||||
if (type && distTag) {
|
||||
// map all types of releases to prereleases
|
||||
releaseType = {
|
||||
'major': 'premajor',
|
||||
'minor': 'preminor',
|
||||
'patch': 'prepatch'
|
||||
}[type] || type;
|
||||
|
||||
console.log("Publishing a " + releaseType + " release.");
|
||||
}
|
||||
|
||||
cb(error, releaseType);
|
||||
});
|
||||
};
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
const conditionTravis = require('@semantic-release/condition-travis');
|
||||
|
||||
module.exports = function (pluginConfig, config, cb) {
|
||||
const branch = config.env.TRAVIS_BRANCH;
|
||||
const distTag = config.options.branchTags[branch];
|
||||
|
||||
// update semantic-release configuration to publish:
|
||||
// - from this branch
|
||||
// - with the specified dist tag
|
||||
if (distTag) {
|
||||
console.log(`Enable prerelease on dist-tag '${distTag}'.`);
|
||||
|
||||
config.options.branch = branch;
|
||||
config.npm.tag = distTag;
|
||||
}
|
||||
|
||||
// run default travis checks with the new configuration
|
||||
return conditionTravis(pluginConfig, config, cb);
|
||||
};
|
|
@ -0,0 +1,15 @@
|
|||
module.exports = function (pluginConfig, config, cb) {
|
||||
if (config.nextRelease) {
|
||||
// change version suffix of pre-releases from '-number' to '-tag.timestamp'
|
||||
const now = new Date();
|
||||
const timestamp = now.toISOString().replace(/[\-T\:]/g, "").slice(0,12);
|
||||
const suffix = `-${config.npm.tag}.${timestamp}`;
|
||||
const release = config.nextRelease;
|
||||
|
||||
release.version = release.version.replace(/\-.+$/, suffix);
|
||||
|
||||
console.log(`Ready for release v${release.version}`);
|
||||
}
|
||||
|
||||
cb(null);
|
||||
};
|
11
package.json
11
package.json
|
@ -16,6 +16,17 @@
|
|||
"publishConfig": {
|
||||
"registry": "https://registry.npm.telerik.com"
|
||||
},
|
||||
"release": {
|
||||
"branchTags": {
|
||||
"develop": "dev"
|
||||
},
|
||||
"fallbackTags": {
|
||||
"dev": "latest"
|
||||
},
|
||||
"verifyConditions": "./build/sr-verifyConditions",
|
||||
"analyzeCommits": "./build/sr-analyzeCommits",
|
||||
"verifyRelease": "./build/sr-verifyRelease"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "sass-lint -v -c ./sass-lint.yml",
|
||||
"api": "sassdoc ./scss/",
|
||||
|
|
Загрузка…
Ссылка в новой задаче