- Allow to configure multiple branches to release from - Allow to define a distribution channel associated with each branch - Manage the availability on distribution channels based on git merges - Support regular releases, maintenance releases and pre-releases - Add the `addChannel` plugin step to make an existing release available on a different distribution channel BREAKING CHANGE: the `branch` option has been removed in favor of `branches` The new `branches` option expect either an Array or a single branch definition. To migrate your configuration: - If you want to publish package from multiple branches, please the configuration documentation - If you use the default configuration and want to publish only from `master`: nothing to change - If you use the `branch` configuration and want to publish only from one branch: replace `branch` by `branches` (`"branch": "my-release-branch"` => `"branches": "my-release-branch"`)
21 lines
836 B
JavaScript
21 lines
836 B
JavaScript
const semver = require('semver');
|
|
const {FIRST_RELEASE, FIRSTPRERELEASE} = require('./definitions/constants');
|
|
|
|
module.exports = ({branch, nextRelease: {type}, lastRelease, logger}) => {
|
|
let version;
|
|
if (lastRelease.version) {
|
|
version =
|
|
branch.type === 'prerelease'
|
|
? semver.prerelease(lastRelease.version)
|
|
? semver.inc(lastRelease.version, 'prerelease')
|
|
: `${semver.inc(lastRelease.version, type)}-${branch.prerelease}.${FIRSTPRERELEASE}`
|
|
: semver.inc(lastRelease.version, type);
|
|
logger.log('The next release version is %s', version);
|
|
} else {
|
|
version = branch.type === 'prerelease' ? `${FIRST_RELEASE}-${branch.prerelease}.${FIRSTPRERELEASE}` : FIRST_RELEASE;
|
|
logger.log(`There is no previous release, the next release version is ${version}`);
|
|
}
|
|
|
|
return version;
|
|
};
|