fix: on maintenance branch add to channel only version >= to start range

This commit is contained in:
Pierre Vanduynslager
2018-12-17 15:23:04 -05:00
parent 162b4b9e3b
commit c22ae17a9b
2 changed files with 37 additions and 27 deletions
+9 -3
View File
@@ -2,7 +2,7 @@ const {uniq} = require('lodash');
const semver = require('semver');
const semverDiff = require('semver-diff');
const getLastRelease = require('./get-last-release');
const {makeTag} = require('./utils');
const {makeTag, getLowerBound} = require('./utils');
/**
* Find releases that have been merged from from a higher branch but not added on the channel of the current branch.
@@ -28,8 +28,14 @@ module.exports = context => {
.reduce(
(releases, higherBranch) => [
...releases,
// For all unique release version of the higher branch merged on current branch
...uniq(branch.tags.filter(({channel}) => channel === higherBranch.channel))
// For all unique release version of the higher branch merged on current branch, excluding lower than start range version for maintenance branches
...uniq(
branch.tags.filter(
({channel, version}) =>
channel === higherBranch.channel &&
(branch.type !== 'maintenance' || semver.gte(version, getLowerBound(branch['merge-range'])))
)
)
// Find ones that are not released on the building branch channel
.filter(tag =>
branch.tags.every(