build: add support for automated minor releases (#20620)

* build: add support for automated minor releases

* Add test for minor bump
This commit is contained in:
John Kleinschmidt 2019-10-23 14:07:10 -04:00 коммит произвёл Samuel Attard
Родитель f5e5bcd943
Коммит 467409458e
3 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -23,7 +23,7 @@ const pass = '✓'.green
const fail = '✗'.red
if (!bumpType && !args.notesOnly) {
console.log(`Usage: prepare-release [stable | beta | nightly]` +
console.log(`Usage: prepare-release [stable | minor | beta | nightly]` +
` (--stable) (--notesOnly) (--automaticRelease) (--branch)`)
process.exit(1)
}

Просмотреть файл

@ -90,6 +90,9 @@ async function nextVersion (bumpType, version) {
break
case 'beta':
throw new Error('Cannot bump to beta from stable.')
case 'minor':
version = semver.inc(version, 'minor')
break
case 'stable':
version = semver.inc(version, 'patch')
break

Просмотреть файл

@ -100,6 +100,12 @@ describe('version-bumper', () => {
expect(next).to.equal('2.0.1')
})
it('bumps to minor from stable', async () => {
const version = 'v2.0.0'
const next = await nextVersion('minor', version)
expect(next).to.equal('2.1.0')
})
it('bumps to stable from nightly', async () => {
const version = 'v2.0.0-nightly.19950901'
const next = await nextVersion('stable', version)